summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-09 19:31:50 (UTC)
committer zautrix <zautrix>2005-02-09 19:31:50 (UTC)
commita9eff860d8399a198a9fdc04e09ed369097fc745 (patch) (unidiff)
treec953f38ef75bed96bdedd61b1b4bf369e08cddee
parent22d5db839c9741cb2e988e84bbb367617934ebd9 (diff)
downloadkdepimpi-a9eff860d8399a198a9fdc04e09ed369097fc745.zip
kdepimpi-a9eff860d8399a198a9fdc04e09ed369097fc745.tar.gz
kdepimpi-a9eff860d8399a198a9fdc04e09ed369097fc745.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt9
-rw-r--r--korganizer/mainwindow.cpp18
-rw-r--r--korganizer/mainwindow.h1
-rw-r--r--libkdepim/ksyncmanager.cpp13
-rw-r--r--libkdepim/ksyncmanager.h2
5 files changed, 34 insertions, 9 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 65bb075..6ccf763 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,938 +1,947 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.6 ************
4
5Two bugfixes in the pi-sync mode.
6KO/Pi:
7Made the todolist using alternate background.
8
9Other minor fixes in KO/Pi.
10
11
3********** VERSION 2.0.5 ************ 12********** VERSION 2.0.5 ************
4 13
5Bugfixes in KO/Pi. 14Bugfixes in KO/Pi.
6 15
7********** VERSION 2.0.4 ************ 16********** VERSION 2.0.4 ************
8 17
9KO/Pi: 18KO/Pi:
10Fixed problem loading translations for summary/location edit boxes in event/todo editor. 19Fixed problem loading translations for summary/location edit boxes in event/todo editor.
11 20
12Added a general "select week number" to the toolbar. 21Added a general "select week number" to the toolbar.
13 22
14Fixed some small problem of the new features introduced in version 2.0.3. 23Fixed some small problem of the new features introduced in version 2.0.3.
15 24
16Made it possible to specify one specific category as category color, 25Made it possible to specify one specific category as category color,
17if more than one categories are selected. 26if more than one categories are selected.
18 27
19Fixed a bug in saving colors for categories with non-ascii characters. 28Fixed a bug in saving colors for categories with non-ascii characters.
20(Like, e.g. German Umlauts). 29(Like, e.g. German Umlauts).
21Propably you have to set your colors again for those categories. 30Propably you have to set your colors again for those categories.
22 31
23 32
24********** VERSION 2.0.3 ************ 33********** VERSION 2.0.3 ************
25 34
26KO/Pi: 35KO/Pi:
27Added feature for changing alarm settings for many items at once: 36Added feature for changing alarm settings for many items at once:
28Open list view (or search dialog), select the desired items and choose in 37Open list view (or search dialog), select the desired items and choose in
29the popup menu: Set alarm for selected... 38the popup menu: Set alarm for selected...
30 39
31Added to the event/todo viewer the option to send an email to 40Added to the event/todo viewer the option to send an email to
32all attendees or all selected (with RSVP) attendees. 41all attendees or all selected (with RSVP) attendees.
33 42
34Made the week-month mode changing in month view faster. 43Made the week-month mode changing in month view faster.
35 44
36Made month view better useable with keyboard. 45Made month view better useable with keyboard.
37Now TAB key jumps to next cell with an event/todo. 46Now TAB key jumps to next cell with an event/todo.
38Scroll in cell with coursor keys, scroll in time (next week) with 47Scroll in cell with coursor keys, scroll in time (next week) with
39Shift/Control + coursorkeys. 48Shift/Control + coursorkeys.
40 49
41Fixed bug that the todo view flat mode was reset after first view update. 50Fixed bug that the todo view flat mode was reset after first view update.
42 51
43If a todo is displayed closed in the todo view, 52If a todo is displayed closed in the todo view,
44it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. 53it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
45 54
46Added info about the numbers of years to the caption (title) information about a birthday event. 55Added info about the numbers of years to the caption (title) information about a birthday event.
47 56
48Made completion date in todo editor editable. 57Made completion date in todo editor editable.
49 58
50Added possibility to save/load templates for journals. 59Added possibility to save/load templates for journals.
51(Which is just a simple "save text to file" or "insert text from file". 60(Which is just a simple "save text to file" or "insert text from file".
52 61
53********** VERSION 2.0.2 ************ 62********** VERSION 2.0.2 ************
54 63
55KO/Pi: 64KO/Pi:
56Fixed the layout problem of the day label buttons 65Fixed the layout problem of the day label buttons
57of the agenda view introduced in version 2.0.1. 66of the agenda view introduced in version 2.0.1.
58 67
59Added WhatsThis support for the todo view and the list view. 68Added WhatsThis support for the todo view and the list view.
60 69
61Added a quite useful feature to the montview. 70Added a quite useful feature to the montview.
62Just click on the week numbers on the left. 71Just click on the week numbers on the left.
63And in the top right corner of month view/agenda view 72And in the top right corner of month view/agenda view
64there is now a "week number quick selector". 73there is now a "week number quick selector".
65(Click on the black triangle). 74(Click on the black triangle).
66 75
67Made the quite difficult timezone change in KO/Pi easy. 76Made the quite difficult timezone change in KO/Pi easy.
68 77
69OM/Pi: 78OM/Pi:
70Fixed too small icons on desktop. 79Fixed too small icons on desktop.
71Fixed non visible icons in mainwindow on Z with fastload enabled. 80Fixed non visible icons in mainwindow on Z with fastload enabled.
72Added signature file setting to smtp account config. 81Added signature file setting to smtp account config.
73And the signature can be edited and saved in the edit mail dialog. 82And the signature can be edited and saved in the edit mail dialog.
74That does mean: 83That does mean:
75Simply edit the signature for the selected smtp account in the 84Simply edit the signature for the selected smtp account in the
76edit new mail dialog and press the "save signature" button there. 85edit new mail dialog and press the "save signature" button there.
77Then the signature is saved to the file specified in the smtp account settings. 86Then the signature is saved to the file specified in the smtp account settings.
78If there is no file specified, it is saved automatically to the file 87If there is no file specified, it is saved automatically to the file
79kdepim/apps/kopiemail/<accountname>.sig. 88kdepim/apps/kopiemail/<accountname>.sig.
80 89
81 90
82 91
83********** VERSION 2.0.1 ************ 92********** VERSION 2.0.1 ************
84 93
85Oooops ... I forgot to test on the Zaurus 5500 ... 94Oooops ... I forgot to test on the Zaurus 5500 ...
86 95
87Fixed many problems of new (english) strings (and german translations) 96Fixed many problems of new (english) strings (and german translations)
88introduced in the latest versions, where the text was not fitting on the 97introduced in the latest versions, where the text was not fitting on the
89240x320 display of the Zaurus 5500. 98240x320 display of the Zaurus 5500.
90 99
91KO/Pi: 100KO/Pi:
92Added a popup menu ( press pen and hold to get popup ) to the agenda view 101Added a popup menu ( press pen and hold to get popup ) to the agenda view
93with many useful items (add event/todo, show next week, two weeks, month, journal). 102with many useful items (add event/todo, show next week, two weeks, month, journal).
94 103
95Added items to the todolist popup menu for: 104Added items to the todolist popup menu for:
96Display all opened, all closed or all todos flat. 105Display all opened, all closed or all todos flat.
97The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 106The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
98Made the reparenting of todos on the desktop possible via Drag&Drop. 107Made the reparenting of todos on the desktop possible via Drag&Drop.
99Fixed several bugs in setting the completed datetime for todos. 108Fixed several bugs in setting the completed datetime for todos.
100Added info about completed datetime of todos to the todo viewer. 109Added info about completed datetime of todos to the todo viewer.
101Now displaying a completed todo (with completed datetime set) in the agenda view 110Now displaying a completed todo (with completed datetime set) in the agenda view
102at the time of the completion. Such that now it is possible to see in the agenda view 111at the time of the completion. Such that now it is possible to see in the agenda view
103when what todo was completed. 112when what todo was completed.
104Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 113Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
105Now the behaviour is: 114Now the behaviour is:
106Setting a parent to complete sets all (sub)childs to complete. 115Setting a parent to complete sets all (sub)childs to complete.
107Setting a parent to uncomplete does not change the childs. 116Setting a parent to uncomplete does not change the childs.
108Setting a child to uncomplete sets all parent to uncomplete. 117Setting a child to uncomplete sets all parent to uncomplete.
109Setting a child to complete does not change the parents. 118Setting a child to complete does not change the parents.
110 119
111Smart updating and double buffering of the daymatrix. 120Smart updating and double buffering of the daymatrix.
112Showing holidays in the day matrix. 121Showing holidays in the day matrix.
113Many other small performance updates. 122Many other small performance updates.
114 123
115Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. 124Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
116 125
117Now the translation file usertranslation.txt is supposed to be in utf8 format. 126Now the translation file usertranslation.txt is supposed to be in utf8 format.
118If 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. 127If 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.
119 128
120 129
121********** VERSION 2.0.0 ************ 130********** VERSION 2.0.0 ************
122 131
123Stable release 2.0.0! 132Stable release 2.0.0!
124 133
125KO/Pi: 134KO/Pi:
126Fixed problem in edit dialog recreation at startup. 135Fixed problem in edit dialog recreation at startup.
127Made "toggle view*" menu items enabled context sensitive. 136Made "toggle view*" menu items enabled context sensitive.
128Changed agenda size menu to items 1-10. 137Changed agenda size menu to items 1-10.
129Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. 138Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down.
130Usebility enhancements in the KO/Pi menus. 139Usebility enhancements in the KO/Pi menus.
131Birthday import now adds year to summary. 140Birthday import now adds year to summary.
132What's Next view shows age in years for birthday. 141What's Next view shows age in years for birthday.
133 142
134OM/Pi: 143OM/Pi:
135Added three info lines to display subject, from and to of selected mails. 144Added three info lines to display subject, from and to of selected mails.
136 145
137KA/Pi: 146KA/Pi:
138Fixed jump bar behaviour on Zaurus. 147Fixed jump bar behaviour on Zaurus.
139Now KA/Pi search field supports searching for a range of starting characters. 148Now KA/Pi search field supports searching for a range of starting characters.
140E.g. to search for all contact beginning with b to n, type 149E.g. to search for all contact beginning with b to n, type
141b-n 150b-n
142in the search field. 151in the search field.
143 152
144********** VERSION 1.9.20 ************ 153********** VERSION 1.9.20 ************
145 154
146KO/Pi: 155KO/Pi:
147Added for the "dislplay one day" agenda mode 156Added for the "dislplay one day" agenda mode
148info in the caption and in the day lables: 157info in the caption and in the day lables:
149Now it is displayed, if the selected day is from "day before yesterday" 158Now it is displayed, if the selected day is from "day before yesterday"
150to "day after tomorrow". 159to "day after tomorrow".
151Made it possible to delete a Todo, which has sub-todos. 160Made it possible to delete a Todo, which has sub-todos.
152Fixed two small problems in the todo view. 161Fixed two small problems in the todo view.
153Added missing German translation for filter edit and print dialog. 162Added missing German translation for filter edit and print dialog.
154Made search dialog closeable by cancel key. 163Made search dialog closeable by cancel key.
155 164
156Made it possible to select in the date picker the (ligt grey ) 165Made it possible to select in the date picker the (ligt grey )
157dates of the prev./next month with the mouse. 166dates of the prev./next month with the mouse.
158 167
159OM/Pi: 168OM/Pi:
160"Delete mail" icon in main window now deletes all selected mails. 169"Delete mail" icon in main window now deletes all selected mails.
161Fixed the problem, that the state flag of imap mails was ignored. 170Fixed the problem, that the state flag of imap mails was ignored.
162Now mails with "FLAG_SEEN" on the imap server get no icon in the list view 171Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
163to indecate that they are already seen. 172to indecate that they are already seen.
164Fixed the problem that the body of some mails was not displayed in the 173Fixed the problem that the body of some mails was not displayed in the
165mail viewer when fetching them from the imap server directly to read them. 174mail viewer when fetching them from the imap server directly to read them.
166Made it (configurable) possible to show the "To:" field in the list view. 175Made it (configurable) possible to show the "To:" field in the list view.
167Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. 176Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
168Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the 177Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the
169local storage folder (specified in account settings) of the account of the mail. 178local storage folder (specified in account settings) of the account of the mail.
170Removed some memory leaks in OM/Pi. 179Removed some memory leaks in OM/Pi.
171 180
172 181
173********** VERSION 1.9.19 ************ 182********** VERSION 1.9.19 ************
174 183
175Added a lot of missing translations to KA/Pi, 184Added a lot of missing translations to KA/Pi,
176Added some missing translations to KO/Pi and OM/Pi. 185Added some missing translations to KO/Pi and OM/Pi.
177 186
178Fixed some minor problems in KA/Pi + KO/Pi. 187Fixed some minor problems in KA/Pi + KO/Pi.
179 188
180Fixed a crash when closing PwM/Pi. 189Fixed a crash when closing PwM/Pi.
181Added German translation for PwM/Pi. 190Added German translation for PwM/Pi.
182 191
183Made view change and Month View update faster in KO/Pi. 192Made view change and Month View update faster in KO/Pi.
184 193
185 194
186********** VERSION 1.9.18 ************ 195********** VERSION 1.9.18 ************
187 196
188FYI: The VERSION 1.9.17 was a testing release only. 197FYI: The VERSION 1.9.17 was a testing release only.
189Please read the changelog of VERSION 1.9.17 as well. 198Please read the changelog of VERSION 1.9.17 as well.
190 199
191Cleaned up the syncing config dialog. 200Cleaned up the syncing config dialog.
192Added sync config options for date range for events. 201Added sync config options for date range for events.
193Added sync config options for filters on incoming data. 202Added sync config options for filters on incoming data.
194Added sync config options for filters on outgoing data. 203Added sync config options for filters on outgoing data.
195Please read the updated SyncHowTo about the new filter settings. 204Please read the updated SyncHowTo about the new filter settings.
196These filter settings make it now possible to sync with shared 205These filter settings make it now possible to sync with shared
197calendars without writing back private or confidential data 206calendars without writing back private or confidential data
198(via the outgoing filters). 207(via the outgoing filters).
199To sync only with particular parts of a shared calendar, 208To sync only with particular parts of a shared calendar,
200the incoming filter settings can be used. 209the incoming filter settings can be used.
201An example can be found in the SyncHowTo. 210An example can be found in the SyncHowTo.
202Same for shared addressbooks. 211Same for shared addressbooks.
203 212
204Added a setting for the global kdepim data storage. 213Added a setting for the global kdepim data storage.
205Usually the data is stored in (yourhomedir/kdepim). 214Usually the data is stored in (yourhomedir/kdepim).
206Now you can set in the Global config dialog TAB, subTAB "Data storage path" 215Now you can set in the Global config dialog TAB, subTAB "Data storage path"
207a directory where all the kdepim data is stored. 216a directory where all the kdepim data is stored.
208That makes it easy to save all kdepim data on a SD card on the Z, for example. 217That makes it easy to save all kdepim data on a SD card on the Z, for example.
209 218
210KO/Pi: 219KO/Pi:
211The timeedit input has a pulldown list for times. 220The timeedit input has a pulldown list for times.
212If opened, this pulldown list should now has the right time highlighted. 221If opened, this pulldown list should now has the right time highlighted.
213Added the possibility to exclude events/todos/journals in a filter. 222Added the possibility to exclude events/todos/journals in a filter.
214You should exclude journals, if you do not want them to sync with a public calendar. 223You should exclude journals, if you do not want them to sync with a public calendar.
215 224
216KA/Pi: 225KA/Pi:
217Added the possibility to in/exclude public/private/confidential contacts to a filter. 226Added the possibility to in/exclude public/private/confidential contacts to a filter.
218If 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 ... 227If 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 ...
219Added printing of card view and details view on desktop. 228Added printing of card view and details view on desktop.
220Printing of list view is not working... 229Printing of list view is not working...
221Added button for removing pictures in contact editor. 230Added button for removing pictures in contact editor.
222Parsing data fix of KA/Pi version 1.9.17. 231Parsing data fix of KA/Pi version 1.9.17.
223Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. 232Fixed the "parse name automatically" problem of KA/Pi version 1.9.17.
224Fixed some syncing merging problems. 233Fixed some syncing merging problems.
225 234
226 235
227********** VERSION 1.9.17 ************ 236********** VERSION 1.9.17 ************
228 237
229KO/Pi: 238KO/Pi:
230Fixed that tooltips were not updated after moving an item in agenda view. 239Fixed that tooltips were not updated after moving an item in agenda view.
231Fixed a bug in sorting start date for recurring events in list view. 240Fixed a bug in sorting start date for recurring events in list view.
232Changed the left button in todo viewer from "Agenda" to "Set completed". 241Changed the left button in todo viewer from "Agenda" to "Set completed".
233This 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. 242This 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.
234Added more info in the todo viewer: Startdate, parent/sub todos. 243Added more info in the todo viewer: Startdate, parent/sub todos.
235 244
236 245
237KA/Pi: 246KA/Pi:
238All fields search does now actually search all the (possible) fields, 247All fields search does now actually search all the (possible) fields,
239not only those listed in the contact list. 248not only those listed in the contact list.
240Made is possible to inline a picture in a vcard on the Z. 249Made is possible to inline a picture in a vcard on the Z.
241This was only possible on the desktop, now is it possible on the Z as well. 250This was only possible on the desktop, now is it possible on the Z as well.
242Fixed of missing save settings after filter configuration. 251Fixed of missing save settings after filter configuration.
243Made saving of addressbook much faster. 252Made saving of addressbook much faster.
244Fixed extension widget layout problem. 253Fixed extension widget layout problem.
245Fixed saving of default formatted name settings. 254Fixed saving of default formatted name settings.
246Fixed formatted name handling in edit dialog. 255Fixed formatted name handling in edit dialog.
247Added an option for changing formatted names of many contacts 256Added an option for changing formatted names of many contacts
248(menu: File - Change - Set formatted name). 257(menu: File - Change - Set formatted name).
249 258
250QWhatsThis was not working on the Z ( only black rectangle was shown). 259QWhatsThis was not working on the Z ( only black rectangle was shown).
251This is Fixed. 260This is Fixed.
252 261
253KDE-Sync: 262KDE-Sync:
254Now readonly KDE resources are synced as well. 263Now readonly KDE resources are synced as well.
255(They are not changed in KDE itself, of course). 264(They are not changed in KDE itself, of course).
256 265
257 266
258 267
259********** VERSION 1.9.16 ************ 268********** VERSION 1.9.16 ************
260 269
261KO/Pi: 270KO/Pi:
262Fixed search dialog size on Z 6000 (480x640 display). 271Fixed search dialog size on Z 6000 (480x640 display).
263Added setting to hide/show time in agenda items. 272Added setting to hide/show time in agenda items.
264Added setting to hide not running todos in todo view. 273Added setting to hide not running todos in todo view.
265Added columns for start date/time in todo view. 274Added columns for start date/time in todo view.
266Replaced the solid half-hour lines in agenda view by dot lines. 275Replaced the solid half-hour lines in agenda view by dot lines.
267Added possibility of printing the What's Next View on the desktop 276Added possibility of printing the What's Next View on the desktop
268(i.e. Windows and Linux). 277(i.e. Windows and Linux).
269Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. 278Fixed a crash in KO/Pi when starting KO/Pi with What's Next view.
270Added tooltips in month view.(Tooltips only available on desktop) 279Added tooltips in month view.(Tooltips only available on desktop)
271 280
272Fixed a strange problem in KO/Pi alarm applet. 281Fixed a strange problem in KO/Pi alarm applet.
273Did not find the actual problem, 282Did not find the actual problem,
274such that now Qtopia reboots again if deinstalling the alarm applet. 283such that now Qtopia reboots again if deinstalling the alarm applet.
275But the alarm applet should work again. 284But the alarm applet should work again.
276 285
277KA/Pi: 286KA/Pi:
278Fixed the problem, that internal pictures were not saved. 287Fixed the problem, that internal pictures were not saved.
279 288
280Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. 289Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes.
281 290
282Fixed some minor problems. (Like word wrap in help text windows). 291Fixed some minor problems. (Like word wrap in help text windows).
283 292
284Fixed a compiling problem in microkde/kresources. 293Fixed a compiling problem in microkde/kresources.
285 294
286KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. 295KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM.
287This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) 296This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9)
288such that now syncing KO/Pi with Sharp DTM should work on the 297such that now syncing KO/Pi with Sharp DTM should work on the
289Zaurus C 3000 model. 298Zaurus C 3000 model.
290 299
291********** VERSION 1.9.15 ************ 300********** VERSION 1.9.15 ************
292 301
293Usebilty enhancements in KO/Pi: 302Usebilty enhancements in KO/Pi:
294When clicking on the date in a month view cell, the day view is shown. 303When clicking on the date in a month view cell, the day view is shown.
295Old behaviour was, that the "new event" dialog popped up. 304Old behaviour was, that the "new event" dialog popped up.
296 305
297Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). 306Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
298That means, you can restore the latest 307That means, you can restore the latest
299event/todo/journal you have deleted. 308event/todo/journal you have deleted.
300A journal is deleted, if you clear all the text of the journal. 309A journal is deleted, if you clear all the text of the journal.
301 310
302Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. 311Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
303 312
304KA/Pi starting in 480x640 resolution: 313KA/Pi starting in 480x640 resolution:
305Hide the filter action in toolbar 314Hide the filter action in toolbar
306and added icons for undo/delete/redo in toolbar. 315and added icons for undo/delete/redo in toolbar.
307 316
308Change in OM/Pi ViewMail dialog: 317Change in OM/Pi ViewMail dialog:
309When clicking on the "delete" icon the mail is deleted after confirmation as usual. 318When clicking on the "delete" icon the mail is deleted after confirmation as usual.
310But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). 319But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
311 320
312Fixed a crash when deleting mail-accounts in OM/Pi. 321Fixed a crash when deleting mail-accounts in OM/Pi.
313 322
314 323
315********** VERSION 1.9.14 ************ 324********** VERSION 1.9.14 ************
316 325
317Fixed some problems with the dialog sizes when switching 326Fixed some problems with the dialog sizes when switching
318portrait/landscape mode on 640x480 PDA display. 327portrait/landscape mode on 640x480 PDA display.
319 328
320Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. 329Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
321 330
322Fixed an ugly bug in KOpieMail: 331Fixed an ugly bug in KOpieMail:
323KOpieMail was not able to write files (mails) to MSDOS file system, 332KOpieMail was not able to write files (mails) to MSDOS file system,
324like on an usual preformatted SD card. That should work now. 333like on an usual preformatted SD card. That should work now.
325To save your mail data on the Sd card do the following: 334To save your mail data on the Sd card do the following:
326Create a dir on the SD card: 335Create a dir on the SD card:
327mkdir /mnt/card/localmail 336mkdir /mnt/card/localmail
328Go to your home dir: 337Go to your home dir:
329cd 338cd
330Go to kopiemail data storage dir: 339Go to kopiemail data storage dir:
331cd kdepim/apps/kopiemail 340cd kdepim/apps/kopiemail
332Create a symlink to the SD card: 341Create a symlink to the SD card:
333ls -s /mnt/card/localmail 342ls -s /mnt/card/localmail
334Now KOpieMail will store all mails on the SD card. 343Now KOpieMail will store all mails on the SD card.
335 344
336KO/Pi Monthview: 345KO/Pi Monthview:
337Now "Go to Today" selects the current month from day 1-end, 346Now "Go to Today" selects the current month from day 1-end,
338not the current date + some days. 347not the current date + some days.
339I.e. "Go to Today" shows now always 348I.e. "Go to Today" shows now always
340the current month with first day of month in the first row. 349the current month with first day of month in the first row.
341 350
342Added missing German translation. 351Added missing German translation.
343 352
344Fixed icons of executeable on Wintendo. 353Fixed icons of executeable on Wintendo.
345 354
346Added a "Show next Mail" button to the OM/Pi 355Added a "Show next Mail" button to the OM/Pi
347mail viewer such that the mail below the current mail 356mail viewer such that the mail below the current mail
348in the mail list view of the current folder 357in the mail list view of the current folder
349can be read with a single click. 358can be read with a single click.
350 359
351 360
352********** VERSION 1.9.13 ************ 361********** VERSION 1.9.13 ************
353 362
354Fixed nasty PwM/Pi file reading bug, when 363Fixed nasty PwM/Pi file reading bug, when
355the used hash algo of file is different then the global 364the used hash algo of file is different then the global
356hash algo. 365hash algo.
357 366
358Added KA/Pi support for opie mailit mailapplication. 367Added KA/Pi support for opie mailit mailapplication.
359 368
360Fixed some bugs in OM/Pi. 369Fixed some bugs in OM/Pi.
361Now character conversion tables are available for the Zaurus 370Now character conversion tables are available for the Zaurus
362to make OM/Pi working properly. 371to make OM/Pi working properly.
363To get the character conversion in OM/Pi working, please download 372To get the character conversion in OM/Pi working, please download
364at the sourceforge project site the package 373at the sourceforge project site the package
365sr-character-conversion_SharpROM_arm.ipk.zip 374sr-character-conversion_SharpROM_arm.ipk.zip
366(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) 375(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms)
367from the section "general files for KDE/Pim" 376from the section "general files for KDE/Pim"
368Instructions how to install this package are in a ReadMe in this file. 377Instructions how to install this package are in a ReadMe in this file.
369 378
370 379
371Fixed the orientation change problem in KA/Pi when switching 380Fixed the orientation change problem in KA/Pi when switching
372portrait/landscape mode. 381portrait/landscape mode.
373 382
374French translation available for KA/Pi and OM/Pi. 383French translation available for KA/Pi and OM/Pi.
375 384
376Fixed some problems with categories in KO/Pi in DTM sync. 385Fixed some problems with categories in KO/Pi in DTM sync.
377 386
378Added selection dialog for export to phone in KA/Pi. 387Added selection dialog for export to phone in KA/Pi.
379 388
380If in KO/Pi is an attendee selected to add to a meeting and this 389If in KO/Pi is an attendee selected to add to a meeting and this
381attendee is already in the list of attendees, this person is not added 390attendee is already in the list of attendees, this person is not added
382again. 391again.
383 392
384Some menu cleanup in KA/Pi. 393Some menu cleanup in KA/Pi.
385 394
386********** VERSION 1.9.12 ************ 395********** VERSION 1.9.12 ************
387 396
388Fix for the bug in KO/Pi What's Next view of version 1.9.11. 397Fix for the bug in KO/Pi What's Next view of version 1.9.11.
389 398
390Bugfix: Licence file is now shown again. 399Bugfix: Licence file is now shown again.
391 400
392OM/Pi now supports Unicode (utf8 charset). 401OM/Pi now supports Unicode (utf8 charset).
393Fixed some bugs in OM/Pi. 402Fixed some bugs in OM/Pi.
394 403
395KA/Pi has more German translation. 404KA/Pi has more German translation.
396 405
397 406
398********** VERSION 1.9.11 ************ 407********** VERSION 1.9.11 ************
399 408
400Fixed several problems in PWM/Pi, like 409Fixed several problems in PWM/Pi, like
401asking the user, if unsaved changed are pending 410asking the user, if unsaved changed are pending
402when closing the app. 411when closing the app.
403And PwM/Pi handles now different texts for the 412And PwM/Pi handles now different texts for the
404fields Description, Username, Password, configurable per category. 413fields Description, Username, Password, configurable per category.
405 414
406Fixed a crash in KO/Pi , when importing/loading vcs files 415Fixed a crash in KO/Pi , when importing/loading vcs files
407which have an entry with an attendee with state: 416which have an entry with an attendee with state:
408NEEDS ACTION 417NEEDS ACTION
409 418
410Fixed some problems in the German translation of OM/Pi, 419Fixed some problems in the German translation of OM/Pi,
411which makes some dialogs not fitting on the screen 420which makes some dialogs not fitting on the screen
412of the Z 5500. 421of the Z 5500.
413 422
414Fixed Qtopia crash, when disabling/deinstalling 423Fixed Qtopia crash, when disabling/deinstalling
415KO/Pi alarm applet. 424KO/Pi alarm applet.
416 425
417Implemented direct KDE<->KA/Pi sync for KA/Pi running 426Implemented direct KDE<->KA/Pi sync for KA/Pi running
418on Linux desktop. 427on Linux desktop.
419 428
420Added feature "remove sync info" to sync menu. 429Added feature "remove sync info" to sync menu.
421 430
422Tweaked the KO/Pi What's next view a bit, added 431Tweaked the KO/Pi What's next view a bit, added
423setting to hide events that are done. 432setting to hide events that are done.
424 433
425Disabled "beam receive enabled" on startup to 434Disabled "beam receive enabled" on startup to
426avoid problems if Fastload is enabled. 435avoid problems if Fastload is enabled.
427Please set "beam receive enabled", 436Please set "beam receive enabled",
428if you want to receive data via IR. 437if you want to receive data via IR.
429 438
430Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running 439Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
431on Linux desktop. 440on Linux desktop.
432 441
433Made in KA/Pi scrolling possible, if details view is selected. 442Made in KA/Pi scrolling possible, if details view is selected.
434(The keyboard focus is set automatically to the search line) 443(The keyboard focus is set automatically to the search line)
435 444
436Fixed a bug in DMT sync, that a new entry in DTM was added 445Fixed a bug in DMT sync, that a new entry in DTM was added
437on every sync to Kx/Pi. 446on every sync to Kx/Pi.
438 447
439Fixed missing writing of KA/Pi categories to DMT entries when syncing. 448Fixed missing writing of KA/Pi categories to DMT entries when syncing.
440 449
441Fixed a bug in DMT sync with todos created in KO/Pi containing 450Fixed a bug in DMT sync with todos created in KO/Pi containing
442non-latin1 characters. 451non-latin1 characters.
443 452
444Rearranged package contents of Sharp-ipks and made all 453Rearranged package contents of Sharp-ipks and made all
445packages installable on SD again. 454packages installable on SD again.
446 455
447Fixed the writing of addressbook data in DTM sync. 456Fixed the writing of addressbook data in DTM sync.
448Empty fields in KA/Pi were not removed. 457Empty fields in KA/Pi were not removed.
449 458
450Added better category handling in KA/Pi: 459Added better category handling in KA/Pi:
451Added item 460Added item
452Edit Categories and 461Edit Categories and
453Manage new categories 462Manage new categories
454to the settings menu. 463to the settings menu.
455Possible to configure a view to display categories. 464Possible to configure a view to display categories.
456 465
457Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. 466Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu.
458 467
459Fixed displaying of "free" days and time in KO Monthview and Agendaview. 468Fixed displaying of "free" days and time in KO Monthview and Agendaview.
460 469
461... and many other bugfixes. 470... and many other bugfixes.
462 471
463********** VERSION 1.9.10 ************ 472********** VERSION 1.9.10 ************
464 473
465Many internal small bugfixes. 474Many internal small bugfixes.
466And fix of the "big" bug in KO/Pi, 475And fix of the "big" bug in KO/Pi,
467that after Syncing the appointments had an offset by several hours. 476that after Syncing the appointments had an offset by several hours.
468That was a problem with the internal timezone setting, 477That was a problem with the internal timezone setting,
469introduced by the changed timezone configuration settings. 478introduced by the changed timezone configuration settings.
470 479
471German translation for OM/Pi is now available. 480German translation for OM/Pi is now available.
472 481
473 482
474********** VERSION 1.9.9 ************ 483********** VERSION 1.9.9 ************
475 484
476KDE-Pim/Pi has a new Member! 485KDE-Pim/Pi has a new Member!
477It is called PWM/Pi (Passwordmanager/platform-independent) 486It is called PWM/Pi (Passwordmanager/platform-independent)
478and it is available for the Zaurus. 487and it is available for the Zaurus.
479It is planned, that it will be available later for Windows. 488It is planned, that it will be available later for Windows.
480(And for Linux, of course). 489(And for Linux, of course).
481It is a port of the Passwordmanager of KDE. 490It is a port of the Passwordmanager of KDE.
482It will need the MicroKDElibs to run. 491It will need the MicroKDElibs to run.
483 492
484Made loading of addressbooks in KA/Pi up to 7 times faster! 493Made loading of addressbooks in KA/Pi up to 7 times faster!
485The bigger your addressbook file, the more starting speed 494The bigger your addressbook file, the more starting speed
486will you gain. (relatively) 495will you gain. (relatively)
487 496
488The Qtopia addressbook connector is now platform independend 497The Qtopia addressbook connector is now platform independend
489as well and should work on any platform for importing/exporting 498as well and should work on any platform for importing/exporting
490Qtopia and Opie XML files. 499Qtopia and Opie XML files.
491 500
492Added a +30min feature to the timezone settings to make 501Added a +30min feature to the timezone settings to make
493KDE-Pim/Pi useable in Australia and other parts on the 502KDE-Pim/Pi useable in Australia and other parts on the
494world with strange timezones ;-) 503world with strange timezones ;-)
495 504
496German "Umlaute" should now be sorted correctly on the Z in KA/Pi. 505German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
497 506
498It is now possible to disable the 507It is now possible to disable the
499"receive data via infrared" feature, such that syncing with 508"receive data via infrared" feature, such that syncing with
500Outlook is now possible again with Kx/Pi runing. 509Outlook is now possible again with Kx/Pi runing.
501Please disable it, before syncing Sharp DTM with Outlook. 510Please disable it, before syncing Sharp DTM with Outlook.
502For your convenience, the "receive data via infrared" feature 511For your convenience, the "receive data via infrared" feature
503is disabled automatically, if you sync Kx/Pi with DTM. 512is disabled automatically, if you sync Kx/Pi with DTM.
504You have to enable it again manually after syncing. 513You have to enable it again manually after syncing.
505Enabling this feature makes it impossible to start the 514Enabling this feature makes it impossible to start the
506Sharp DTM apps. If this feature is enabled, you will only get the 515Sharp DTM apps. If this feature is enabled, you will only get the
507alarm notification from KO/Pi and not from the Sharp calendar. 516alarm notification from KO/Pi and not from the Sharp calendar.
508This is very useful if you sync KO/Pi with Sharp DTM, 517This is very useful if you sync KO/Pi with Sharp DTM,
509because after syncing you usually would get notified about 518because after syncing you usually would get notified about
510an alarm by KO/Pi and the Sharp Calendar. 519an alarm by KO/Pi and the Sharp Calendar.
511 520
512Together with the Linux desktop version of KO/Pi 521Together with the Linux desktop version of KO/Pi
513it is now possible to sync KO/Pi on the Zaurus 522it is now possible to sync KO/Pi on the Zaurus
514with the complete KDE-desktop (3.3 or later) 523with the complete KDE-desktop (3.3 or later)
515calendar data easily. 524calendar data easily.
516That makes it possible to sync the Z with one 525That makes it possible to sync the Z with one
517click of a mouse with the KDE-Desktop. 526click of a mouse with the KDE-Desktop.
518This feature it available for all Zaurus platforms KO/Pi 527This feature it available for all Zaurus platforms KO/Pi
519is running on. 528is running on.
520The only thing needed is a running KO/Pi on Linux and 529The only thing needed is a running KO/Pi on Linux and
521a compiled version of the small 530a compiled version of the small
522KDE-Pim/Pi<->KDE-Desktop access command line program, 531KDE-Pim/Pi<->KDE-Desktop access command line program,
523which is in the KDE-Pim/Pi sources available. 532which is in the KDE-Pim/Pi sources available.
524 533
525The "KDE-desktop" syncing feature for KA/Pi will follow 534The "KDE-desktop" syncing feature for KA/Pi will follow
526in the next releases. 535in the next releases.
527 536
528Fixed the vcard export bug, which had the version 1.9.8. 537Fixed the vcard export bug, which had the version 1.9.8.
529 538
530Added missing GERMAN translation to KO/Pi. 539Added missing GERMAN translation to KO/Pi.
531Hi PsionX, could you add the missing french translation?Thx! 540Hi PsionX, could you add the missing french translation?Thx!
532 541
533Translation files for KA/Pi are available as well. 542Translation files for KA/Pi are available as well.
534GERMAN translation will be available in the next release. 543GERMAN translation will be available in the next release.
535PsionX ( yres, you again ;-) ), could you start translating 544PsionX ( yres, you again ;-) ), could you start translating
536KA/Pi? Thx! 545KA/Pi? Thx!
537 546
538You can download the version 1.9.9 at 547You can download the version 1.9.9 at
539 548
540http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 549http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604
541 550
542Note: 551Note:
543To run the mail program OM/Pi you need libopenssl. 552To run the mail program OM/Pi you need libopenssl.
544A link to a download loaction is available at 553A link to a download loaction is available at
545ZSI at www.killefiz.de 554ZSI at www.killefiz.de
546 555
547 556
548********** VERSION 1.9.8 ************ 557********** VERSION 1.9.8 ************
549 558
550Fixed character decoding in OM/Pi. 559Fixed character decoding in OM/Pi.
551(e.g. German "Umlaute" were not displayed properly.) 560(e.g. German "Umlaute" were not displayed properly.)
552 561
553Made is possible to reparent todos in KO/Pi. 562Made is possible to reparent todos in KO/Pi.
554Use contextmenu or keys (look at Help-Keys + Colors) for that. 563Use contextmenu or keys (look at Help-Keys + Colors) for that.
555 564
556Added the missing Sync-Howto and WhatsNew to the packages. 565Added the missing Sync-Howto and WhatsNew to the packages.
557 566
558KO/Pi on Linux desktop can now sync with KDE desktop. 567KO/Pi on Linux desktop can now sync with KDE desktop.
559That means: When using KO/Pi on Linux desktop for syncing with 568That means: When using KO/Pi on Linux desktop for syncing with
560KDE desktop and the Zaurus, the Zaurus can be synced now 569KDE desktop and the Zaurus, the Zaurus can be synced now
561with all KDE-Calendar resources, not only with one local file. 570with all KDE-Calendar resources, not only with one local file.
562(That makes it possible to sync the Zaurus with the 571(That makes it possible to sync the Zaurus with the
563calendar data on a Kolab server) 572calendar data on a Kolab server)
564 573
565KA/Pi syncing with KDE desktop will be available in the next version. 574KA/Pi syncing with KDE desktop will be available in the next version.
566 575
567 576
568********** VERSION 1.9.7 ************ 577********** VERSION 1.9.7 ************
569 578
570KO/Pi - KA/Pi on Windows: 579KO/Pi - KA/Pi on Windows:
571Now a directory can be defined by the user, where the 580Now a directory can be defined by the user, where the
572application/config data should be saved. 581application/config data should be saved.
573 Define your desired path in the evironment variable 582 Define your desired path in the evironment variable
574 MICROKDEHOME 583 MICROKDEHOME
575 before starting KO/Pi or KA/Pi. 584 before starting KO/Pi or KA/Pi.
576 585
577An easy Kx/Pi to Kx/Pi syncing is now possible 586An easy Kx/Pi to Kx/Pi syncing is now possible
578(it is called Pi-Sync) via network. 587(it is called Pi-Sync) via network.
579Please look at the Sync Howto. 588Please look at the Sync Howto.
580 589
581Exporting of calendar data and contacts to mobile phones is now possible. 590Exporting of calendar data and contacts to mobile phones is now possible.
582The SyncHowto is updated with information howto 591The SyncHowto is updated with information howto
583access/sync mobile phones. 592access/sync mobile phones.
584Please look at the Sync Howto. 593Please look at the Sync Howto.
585 594
586Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. 595Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly.
587Please disable Fastload for the original contact/calendar applications 596Please disable Fastload for the original contact/calendar applications
588and close them. 597and close them.
589KO/Pi and KA/Pi must be running in order to receive the data. 598KO/Pi and KA/Pi must be running in order to receive the data.
590(KO/Pi and KA/Pi are always running if Fastload for them is enabled!) 599(KO/Pi and KA/Pi are always running if Fastload for them is enabled!)
591 600
592In the KA/Pi details view are now the preferred tel. numbers displayed on top 601In the KA/Pi details view are now the preferred tel. numbers displayed on top
593of the other data ( emails/tel.numbers/addresses) 602of the other data ( emails/tel.numbers/addresses)
594 603
595Fixed some syncing problems in KA/Pi. 604Fixed some syncing problems in KA/Pi.
596 605
597Added font settings for the KA/Pi details view. 606Added font settings for the KA/Pi details view.
598Added fields "children's name" and "gender" to KA/Pi. 607Added fields "children's name" and "gender" to KA/Pi.
599 608
600Made searching in KA/Pi better: 609Made searching in KA/Pi better:
601Now the first item in a view is selected after a search automatically and 610Now the first item in a view is selected after a search automatically and
602the views can be scrolled up/down when the search input field has the keyboard focus. 611the views can be scrolled up/down when the search input field has the keyboard focus.
603 612
604And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. 613And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi.
605 614
606 615
607********** VERSION 1.9.6 ************ 616********** VERSION 1.9.6 ************
608 617
609Changes in the external application communication on the Zaurus 618Changes in the external application communication on the Zaurus
610in order to use less RAM when the apps are running. 619in order to use less RAM when the apps are running.
611First syncing of addressbooks (KA/Pi) is possible. 620First syncing of addressbooks (KA/Pi) is possible.
612 621
613 622
614********** VERSION 1.9.5a ************ 623********** VERSION 1.9.5a ************
615 624
616Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. 625Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5.
617Fixed some small bugs. 626Fixed some small bugs.
618KA/Pi shows now the birthday in summary view. 627KA/Pi shows now the birthday in summary view.
619Now OM/Pi and KA/Pi are using the date format defined in KO/Pi 628Now OM/Pi and KA/Pi are using the date format defined in KO/Pi
620for displaying dates. 629for displaying dates.
621 630
622 631
623********** VERSION 1.9.5 ************ 632********** VERSION 1.9.5 ************
624 633
625There is still no Addressbook syncing! 634There is still no Addressbook syncing!
626 635
627New in 1.9.5: 636New in 1.9.5:
628 637
629Many bugfixes. 638Many bugfixes.
630Better searching in KA/Pi. 639Better searching in KA/Pi.
631You can configure in KA/Pi if you want to search only after 640You can configure in KA/Pi if you want to search only after
632<return> key pressed. 641<return> key pressed.
633 642
634Better mail downloading in OM/Pi. 643Better mail downloading in OM/Pi.
635 644
636First experimental alpha version of sync of KO/Pi with mobile phones. 645First experimental alpha version of sync of KO/Pi with mobile phones.
637See gammu documentation for supported phones. 646See gammu documentation for supported phones.
638You 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. 647You 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.
639Quick hint how to use: 648Quick hint how to use:
640NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! 649NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL!
641Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. 650Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp.
642Create syncprofile - mobile device 651Create syncprofile - mobile device
643Remove entry for model. (Leave empty ). 652Remove entry for model. (Leave empty ).
644Enable infrared on Zaurus and your Phone. 653Enable infrared on Zaurus and your Phone.
645Sync. 654Sync.
646To get a more detailed log, start kopi from konsole. 655To get a more detailed log, start kopi from konsole.
647 656
648********** VERSION 1.9.4 ************ 657********** VERSION 1.9.4 ************
649 658
650This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. 659This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus.
651 660
652WARNING: 661WARNING:
653PLEASE BACKUP ALL YOUR DATA! 662PLEASE BACKUP ALL YOUR DATA!
654We have changed a lot and maybe there are some unknown problems. 663We have changed a lot and maybe there are some unknown problems.
655 664
656SYNC HANDLING HAS CHANGED! 665SYNC HANDLING HAS CHANGED!
657Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 666Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
658(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 667(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
659 668
660You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. 669You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs.
661If 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. 670If 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.
662 671
663As programs are available: 672As programs are available:
664KO/Pi (korganizer ipk) - a calendar program. 673KO/Pi (korganizer ipk) - a calendar program.
665KA/Pi (kaddressbook ipk ) - an addressbook 674KA/Pi (kaddressbook ipk ) - an addressbook
666OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. 675OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support.
667 676
668An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. 677An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode.
669(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) 678(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia)
670 679
671All the applications are installed in a "Pim" TAB. 680All the applications are installed in a "Pim" TAB.
672If 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 681If 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
673 682
674All the application are integrated. 683All the application are integrated.
675Such 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. 684Such 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.
676 685
677HINT: 686HINT:
678If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. 687If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number.
679 688
680What's new? 689What's new?
681 690
682SYNC HANDLING HAS CHANGED! 691SYNC HANDLING HAS CHANGED!
683Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 692Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
684(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 693(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
685 694
686New in OM/Pi: 695New in OM/Pi:
687When 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. 696When 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.
688 697
689New in KO/Pi: 698New in KO/Pi:
690French is now available for KO/Pi. 699French is now available for KO/Pi.
691Choose menu:Actions - Configure:TAB locale 700Choose menu:Actions - Configure:TAB locale
692Syncing has changed. 701Syncing has changed.
693Phone sync available soon. 702Phone sync available soon.
694Not much changes, I cannot remember them ... 703Not much changes, I cannot remember them ...
695 704
696New in KA/Pi: 705New in KA/Pi:
697Beaming possible. 706Beaming possible.
698Sharp DTM readonly access possible( create a new DTM resource ); 707Sharp DTM readonly access possible( create a new DTM resource );
699Better searching possible. 708Better searching possible.
700Search is performed only after pressing the return key. 709Search is performed only after pressing the return key.
701Use wildcard * to specify parts of a name. 710Use wildcard * to specify parts of a name.
702 711
703Better 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 * . 712Better 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 * .
704 713
705A big improvement is the new management of the contact access. 714A big improvement is the new management of the contact access.
706In version 1.9.3, every application was using their own addressbook access data. 715In version 1.9.3, every application was using their own addressbook access data.
707That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. 716That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi.
708That was wasting of memory, if you had several hundreds of contacts. 717That was wasting of memory, if you had several hundreds of contacts.
709 718
710Now only KA/Pi accesses the addressbook. 719Now only KA/Pi accesses the addressbook.
711If 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. 720If 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.
712If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. 721If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly.
713That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. 722That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first.
714 723
715New in the KO/Pi alarm applet: 724New in the KO/Pi alarm applet:
716Configure your own timer popup menu! 725Configure your own timer popup menu!
717(Text and minutes for timer countdown) 726(Text and minutes for timer countdown)
718Just edit the file 727Just edit the file
719(yourhomedir)/.kopialarmtimerrc 728(yourhomedir)/.kopialarmtimerrc
720and start/stop a timer to get a new menu with the data of this file. 729and start/stop a timer to get a new menu with the data of this file.
721 730
722********** VERSION 1.9.3 ************ 731********** VERSION 1.9.3 ************
7231) 7321)
724Now KO/Pi on Windows imports directly the calendar data of 733Now KO/Pi on Windows imports directly the calendar data of
725an installed Outlook. Should work with OL version >= 2000. 734an installed Outlook. Should work with OL version >= 2000.
726 735
727********** VERSION 1.9.2 ************ 736********** VERSION 1.9.2 ************
7281) 7371)
729KDE-Pim/Pi has got a new member: 738KDE-Pim/Pi has got a new member:
730KmicroMail (KM/Pi) is a mail program, 739KmicroMail (KM/Pi) is a mail program,
731which can handle IMAP and POP mail access. 740which can handle IMAP and POP mail access.
732It is based on Opie-Mail v3. 741It is based on Opie-Mail v3.
733All dependencies to the Opie libraries ar removed, 742All dependencies to the Opie libraries ar removed,
734such that no additional Opie lib is needed. 743such that no additional Opie lib is needed.
735It is already integrated in KO/Pi and KA/Pi. 744It is already integrated in KO/Pi and KA/Pi.
736It it now available for the Zaurus,probably it 745It it now available for the Zaurus,probably it
737will be available for other platforms later. 746will be available for other platforms later.
738Hint: 747Hint:
739Create your own contact (name + email) 748Create your own contact (name + email)
740in KA/Pi, select this contact and choose menu: 749in KA/Pi, select this contact and choose menu:
741Settings - Set Who Am I. 750Settings - Set Who Am I.
742Now the settings of this contact are used as 751Now the settings of this contact are used as
743the sender data in KM/Pi. 752the sender data in KM/Pi.
7442) 7532)
745KDE-Pim/Pi is split up in five different 754KDE-Pim/Pi is split up in five different
746packages now precompiled for Sharp Zaurus: 755packages now precompiled for Sharp Zaurus:
747--kmicrokdelibs_1.9.2_arm.ipk 756--kmicrokdelibs_1.9.2_arm.ipk
748The libs are needed for any 757The libs are needed for any
749of the following programs: 758of the following programs:
750--kaddressbook_1.9.2_arm.ipk 759--kaddressbook_1.9.2_arm.ipk
751--kmicromail_1.9.2_arm.ipk 760--kmicromail_1.9.2_arm.ipk
752--korganizer_1.9.2_arm.ipk 761--korganizer_1.9.2_arm.ipk
753Independ from that, there is the alarm applet 762Independ from that, there is the alarm applet
754available for KO/Pi, which also offers 763available for KO/Pi, which also offers
755quick access for a new mail or 764quick access for a new mail or
756showing the addressbook.: 765showing the addressbook.:
757--korganizer-alarm_1.9.2_arm.ipk 766--korganizer-alarm_1.9.2_arm.ipk
758Independend means, that the alarm applet 767Independend means, that the alarm applet
759does not need any of the libs or programs above to run. 768does not need any of the libs or programs above to run.
760But it would be quite useless without these programs. 769But it would be quite useless without these programs.
761NOTE: 770NOTE:
762If you get a 771If you get a
763"This application depends on other programs" 772"This application depends on other programs"
764during installation of 773during installation of
765--kmicrokdelibs_1.9.2_arm.ipk 774--kmicrokdelibs_1.9.2_arm.ipk
766you probably do not have to care about that. 775you probably do not have to care about that.
767kmicrokdelibs_1.9.2 will come with some 776kmicrokdelibs_1.9.2 will come with some
768resource plugins, which needs additional libraries. 777resource plugins, which needs additional libraries.
769(E.g. libopie1, if you want to use the 778(E.g. libopie1, if you want to use the
770opie resource connector in KA/Pi). 779opie resource connector in KA/Pi).
771If you do not have this libraries installed, 780If you do not have this libraries installed,
772you simply cannot use the resource. 781you simply cannot use the resource.
773To make it clear: 782To make it clear:
774If the libraries are missing, the applications 783If the libraries are missing, the applications
775using kmicrokdelibs will start, 784using kmicrokdelibs will start,
776because the resources are plugins. 785because the resources are plugins.
7773) 7863)
778KO/Pi and friends are now installable on SD-Card! 787KO/Pi and friends are now installable on SD-Card!
779It is recommended to install all libs and apps 788It is recommended to install all libs and apps
780on the SD card or all in the internal storage. 789on the SD card or all in the internal storage.
781There may be problems, if this is mixed. 790There may be problems, if this is mixed.
7824) 7914)
783Fixed two bugs in the alarm notification on Windows. 792Fixed two bugs in the alarm notification on Windows.
7845) 7935)
785Great improvement! 794Great improvement!
786KO/Pi uses now the latest version of libical. 795KO/Pi uses now the latest version of libical.
787Libical is the library which actually reads 796Libical is the library which actually reads
788the calendar files and extract the data from it. 797the calendar files and extract the data from it.
789With the old version, there were problems 798With the old version, there were problems
790(crashes or program hangs) when licical did read 799(crashes or program hangs) when licical did read
791files, which were not stored from KO/Pi. 800files, which were not stored from KO/Pi.
792I do not know, if the new libical works perfect, 801I do not know, if the new libical works perfect,
793but actually it works much better than 802but actually it works much better than
794the old version. 803the old version.
795There are no problems with compatibility with 804There are no problems with compatibility with
796old calendar files of KO/Pi, of course! 805old calendar files of KO/Pi, of course!
7976) 8066)
798New in KA/Pi: 807New in KA/Pi:
799Opie addressbook resource connector available! 808Opie addressbook resource connector available!
800You will need libopie1 and the opie addressbook, 809You will need libopie1 and the opie addressbook,
801of course. 810of course.
802With the Opie addressbook resource connector, 811With the Opie addressbook resource connector,
803you can access the Opie addressbook readonly in KA/Pi. 812you can access the Opie addressbook readonly in KA/Pi.
804If you want to edit or import the data into KA/Pi, 813If you want to edit or import the data into KA/Pi,
805do this: 814do this:
806a) Create an Opie resource. 815a) Create an Opie resource.
807 (Menu: Settings-Configure Resources). 816 (Menu: Settings-Configure Resources).
808After configuration and restarting KA/Pi you should see 817After configuration and restarting KA/Pi you should see
809the Opie contacts in KA/Pi. 818the Opie contacts in KA/Pi.
810b) Select some or all Opie contacts. 819b) Select some or all Opie contacts.
811(NOTE: +++++ 820(NOTE: +++++
812To know exactly, what contacts are Opie contacts, 821To know exactly, what contacts are Opie contacts,
813do this: Choose menu: 822do this: Choose menu:
814View-Modify View - TAB Fields. 823View-Modify View - TAB Fields.
815Select in the above list "Resource" and click 824Select in the above list "Resource" and click
816down arrow to add it to the "Selected fields". 825down arrow to add it to the "Selected fields".
817Click OK. 826Click OK.
818Now you have a new column "Resource" in your list, 827Now you have a new column "Resource" in your list,
819where you can see, what an Opie resource is. 828where you can see, what an Opie resource is.
820++++ NOTE end.) 829++++ NOTE end.)
821Ok, we do have now some Opie contacts seleted. 830Ok, we do have now some Opie contacts seleted.
822(Use SHIFT or CTRL key in order to multiple select). 831(Use SHIFT or CTRL key in order to multiple select).
823c) Choose menu: Edit-Copy. 832c) Choose menu: Edit-Copy.
824d) Choose menu: Edit-Paste. 833d) Choose menu: Edit-Paste.
825e) Select the resource, you want to add the contacts to. 834e) Select the resource, you want to add the contacts to.
826Congrats! Now you have read/write access to the copied 835Congrats! Now you have read/write access to the copied
827opie contacts as "real" KA/Pi contacts. 836opie contacts as "real" KA/Pi contacts.
828 837
829 838
830********** VERSION 1.9.1 ************ 839********** VERSION 1.9.1 ************
8311) 8401)
832 +++ IMPORTANT 1 +++ 841 +++ IMPORTANT 1 +++
833 842
834The storing place of the default calendar 843The storing place of the default calendar
835file has changed! 844file has changed!
836The default calendar file was 845The default calendar file was
837Applications/korganizer/mycalendar.ics 846Applications/korganizer/mycalendar.ics
838on Zaurus and 847on Zaurus and
839(yourHomeDir)/korganizer/mycalendar.ics 848(yourHomeDir)/korganizer/mycalendar.ics
840on Windows/Linux desktop. Now it is 849on Windows/Linux desktop. Now it is
841(yourHomeDir)/kdepim/korganizer/mycalendar.ics 850(yourHomeDir)/kdepim/korganizer/mycalendar.ics
842on Zaurus, Windows and Linux. 851on Zaurus, Windows and Linux.
843To load the old file, choose menu 852To load the old file, choose menu
844File-Load calendar backup. 853File-Load calendar backup.
845(It should be loaded automatically 854(It should be loaded automatically
846at startup with a warning message displayed). 855at startup with a warning message displayed).
847The place of the configuration file has changed too. 856The place of the configuration file has changed too.
848If you want to use your old KO/Pi config, 857If you want to use your old KO/Pi config,
849copy it to 858copy it to
850(yourHomeDir)/kdepim/config/korganizerrc 859(yourHomeDir)/kdepim/config/korganizerrc
851Please read VERSION 1.9.0 - topic 3) as well! 860Please read VERSION 1.9.0 - topic 3) as well!
852 861
853 +++ IMPORTANT 2 +++ 862 +++ IMPORTANT 2 +++
854 863
855Because of the new paths, you will need 864Because of the new paths, you will need
856a new version of the KO/Pi alarm applet 865a new version of the KO/Pi alarm applet
857for Zaurus. 866for Zaurus.
858Use version >= 1.9.1 867Use version >= 1.9.1
859 868
8602) 8692)
861Now the QWhat'sThis Icon works for items 870Now the QWhat'sThis Icon works for items
862in the month view as well. 871in the month view as well.
863(See VERSION 1.7.8 Topic 1) ). 872(See VERSION 1.7.8 Topic 1) ).
8643) 8733)
865You can import birtsdays/anniversaries 874You can import birtsdays/anniversaries
866from KA/Pi into KO/Pi. 875from KA/Pi into KO/Pi.
867Choose menu File-Import birthdays. 876Choose menu File-Import birthdays.
868If you import twice, already imported items 877If you import twice, already imported items
869will not be imported again, if they 878will not be imported again, if they
870have not been changed in KO/Pi. 879have not been changed in KO/Pi.
8714) 8804)
872When syncing with sharp DTM, now a progress 881When syncing with sharp DTM, now a progress
873is shown, when the data is written back. 882is shown, when the data is written back.
874If there is much data in KO/Pi and no data 883If there is much data in KO/Pi and no data
875in DTM, that can take a long time. 884in DTM, that can take a long time.
876(But only for the first time ). 885(But only for the first time ).
8775) 8865)
878In the search dialog, you can search 887In the search dialog, you can search
879now for the name/email of an attendee 888now for the name/email of an attendee
880of an event/todo. 889of an event/todo.
881To get more space for displaying 890To get more space for displaying
882search results, the buttons 891search results, the buttons
883for "search" and "close" on the 892for "search" and "close" on the
884bottom are removed in the PDA version. 893bottom are removed in the PDA version.
885You have to click OK in the top right 894You have to click OK in the top right
886corner to do a search. 895corner to do a search.
8876) 8966)
888Now it is possible to disable the displaying 897Now it is possible to disable the displaying
889of todo items in the Allday part of the Agenda. 898of todo items in the Allday part of the Agenda.
890Choose Menu Action-Configure, 899Choose Menu Action-Configure,
891TAB Todo View, checkbox 900TAB Todo View, checkbox
892"Allday Agenda view shows todos" 901"Allday Agenda view shows todos"
8937) 9027)
894If FastLoad is enabled, now the settings and the 903If FastLoad is enabled, now the settings and the
895calendar data are saved, when KO/Pi is closed. 904calendar data are saved, when KO/Pi is closed.
896(If no Fastload is enabled, KO/Pi saves 905(If no Fastload is enabled, KO/Pi saves
897the data as well, of course) 906the data as well, of course)
8988) 9078)
899The Agenda View has a minimize-splitter now, 908The Agenda View has a minimize-splitter now,
900such that the height of the allday part can be 909such that the height of the allday part can be
901changed quickly. 910changed quickly.
902 911
903********** VERSION 1.9.0 ************ 912********** VERSION 1.9.0 ************
9041) 9131)
905KO/Pi is now merged with the new microKDE from KA/Pi. 914KO/Pi is now merged with the new microKDE from KA/Pi.
906KO/Pi accesses now KA/Pi as the addressbook. 915KO/Pi accesses now KA/Pi as the addressbook.
907The other ddressbook-plugins are not working any longer. 916The other ddressbook-plugins are not working any longer.
908(It is planned, that later KA/Pi itself uses these plugins) 917(It is planned, that later KA/Pi itself uses these plugins)
909New versions of KO/Pi are only available 918New versions of KO/Pi are only available
910together with KA/Pi as the KDE-Pim/Pi package. 919together with KA/Pi as the KDE-Pim/Pi package.
9112) 9202)
912If you click on an attendee of a meeting in the 921If you click on an attendee of a meeting in the
913event viewer, a detailed summary of the 922event viewer, a detailed summary of the
914attendee is shown. 923attendee is shown.
9153) 9243)
916The place of the configuration file has changed. 925The place of the configuration file has changed.
917If you want to use your old KO/Pi config, copy 926If you want to use your old KO/Pi config, copy
918Applications/korganizer/config_korganizerrc 927Applications/korganizer/config_korganizerrc
919to 928to
920Applications/korganizer/config/korganizerrc 929Applications/korganizer/config/korganizerrc
921 930
922********** VERSION 1.7.8 ************ 931********** VERSION 1.7.8 ************
9231) 9321)
924Now the QWhat'sThis ist working. 933Now the QWhat'sThis ist working.
925Enable the QWhat'sThis icon in the toolbar. 934Enable the QWhat'sThis icon in the toolbar.
926(You have to restart to reload the changed toolbar config). 935(You have to restart to reload the changed toolbar config).
927Now click on the QWhat'sThis Icon 936Now click on the QWhat'sThis Icon
928in the top right corner of KO/Pi. 937in the top right corner of KO/Pi.
929Then click on an item in the Agenda View: 938Then click on an item in the Agenda View:
930You will get a detailed display of the items content. 939You will get a detailed display of the items content.
9312) 9402)
932Some other very minor changes. 941Some other very minor changes.
933But I have forgotten the details ... 942But I have forgotten the details ...
934For that reason I start this log here: 943For that reason I start this log here:
935To document my changes, when I am doing it. 944To document my changes, when I am doing it.
936 945
937********** VERSION 1.7.7 ************ 946********** VERSION 1.7.7 ************
938Stable Version of KO/Pi 947Stable Version of KO/Pi
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 468fd5b..18a4b12 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2066 +1,2078 @@
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
65using namespace KCal; 65using 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
76class KOex2phonePrefs : public QDialog 76class 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
125public: 125public:
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
131int globalFlagBlockStartup; 131int globalFlagBlockStartup;
132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
133 QMainWindow( parent, name ) 133 QMainWindow( parent, name )
134{ 134{
135 135
136 136
137#ifdef DESKTOP_VERSION 137#ifdef DESKTOP_VERSION
138 setFont( QFont("Arial"), 14 ); 138 setFont( QFont("Arial"), 14 );
139#endif 139#endif
140 mClosed = false; 140 mClosed = false;
141 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 141 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
142 QString confFile = locateLocal("config","korganizerrc"); 142 QString confFile = locateLocal("config","korganizerrc");
143 QFileInfo finf ( confFile ); 143 QFileInfo finf ( confFile );
144 bool showWarning = !finf.exists(); 144 bool showWarning = !finf.exists();
145 setIcon(SmallIcon( "ko24" ) ); 145 setIcon(SmallIcon( "ko24" ) );
146 mBlockAtStartup = true; 146 mBlockAtStartup = true;
147 mFlagKeyPressed = false; 147 mFlagKeyPressed = false;
148 setCaption("KOrganizer/Pi"); 148 setCaption("KOrganizer/Pi");
149 KOPrefs *p = KOPrefs::instance(); 149 KOPrefs *p = KOPrefs::instance();
150 KPimGlobalPrefs::instance()->setGlobalConfig(); 150 KPimGlobalPrefs::instance()->setGlobalConfig();
151 if ( p->mHourSize > 22 ) 151 if ( p->mHourSize > 22 )
152 p->mHourSize = 22; 152 p->mHourSize = 22;
153 QMainWindow::ToolBarDock tbd; 153 QMainWindow::ToolBarDock tbd;
154 if ( p->mToolBarHor ) { 154 if ( p->mToolBarHor ) {
155 if ( p->mToolBarUp ) 155 if ( p->mToolBarUp )
156 tbd = Bottom; 156 tbd = Bottom;
157 else 157 else
158 tbd = Top; 158 tbd = Top;
159 } 159 }
160 else { 160 else {
161 if ( p->mToolBarUp ) 161 if ( p->mToolBarUp )
162 tbd = Right; 162 tbd = Right;
163 else 163 else
164 tbd = Left; 164 tbd = Left;
165 } 165 }
166 if ( KOPrefs::instance()->mUseAppColors ) 166 if ( KOPrefs::instance()->mUseAppColors )
167 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 167 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
168 globalFlagBlockStartup = 1; 168 globalFlagBlockStartup = 1;
169 iconToolBar = new QPEToolBar( this ); 169 iconToolBar = new QPEToolBar( this );
170 addToolBar (iconToolBar , tbd ); 170 addToolBar (iconToolBar , tbd );
171 mCalendarModifiedFlag = false; 171 mCalendarModifiedFlag = false;
172 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 172 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
173 splash->setAlignment ( AlignCenter ); 173 splash->setAlignment ( AlignCenter );
174 setCentralWidget( splash ); 174 setCentralWidget( splash );
175#ifndef DESKTOP_VERSION 175#ifndef DESKTOP_VERSION
176 showMaximized(); 176 showMaximized();
177#endif 177#endif
178 178
179 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 179 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
180 setDefaultPreferences(); 180 setDefaultPreferences();
181 mCalendar = new CalendarLocal(); 181 mCalendar = new CalendarLocal();
182 mView = new CalendarView( mCalendar, this,"mCalendar " ); 182 mView = new CalendarView( mCalendar, this,"mCalendar " );
183 mView->hide(); 183 mView->hide();
184 //mView->resize(splash->size() ); 184 //mView->resize(splash->size() );
185 initActions(); 185 initActions();
186 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 186 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
187 mSyncManager->setBlockSave(false); 187 mSyncManager->setBlockSave(false);
188 mView->setSyncManager(mSyncManager); 188 mView->setSyncManager(mSyncManager);
189#ifndef DESKTOP_VERSION 189#ifndef DESKTOP_VERSION
190 iconToolBar->show(); 190 iconToolBar->show();
191 qApp->processEvents(); 191 qApp->processEvents();
192#endif 192#endif
193 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 193 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
194 int vh = height() ; 194 int vh = height() ;
195 int vw = width(); 195 int vw = width();
196 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 196 //qDebug("Toolbar hei %d ",iconToolBar->height() );
197 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 197 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
198 vh -= iconToolBar->height(); 198 vh -= iconToolBar->height();
199 } else { 199 } else {
200 vw -= iconToolBar->height(); 200 vw -= iconToolBar->height();
201 } 201 }
202 //mView->setMaximumSize( splash->size() ); 202 //mView->setMaximumSize( splash->size() );
203 //mView->resize( splash->size() ); 203 //mView->resize( splash->size() );
204 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 204 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
205 mView->readSettings(); 205 mView->readSettings();
206 bool newFile = false; 206 bool newFile = false;
207 if( !QFile::exists( defaultFileName() ) ) { 207 if( !QFile::exists( defaultFileName() ) ) {
208 QFileInfo finfo ( defaultFileName() ); 208 QFileInfo finfo ( defaultFileName() );
209 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 209 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
210 qDebug("oldfile %s ", oldFile.latin1()); 210 qDebug("oldfile %s ", oldFile.latin1());
211 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"; 211 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";
212 finfo.setFile( oldFile ); 212 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 213 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 214 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 215 mView->openCalendar( oldFile );
216 qApp->processEvents(); 216 qApp->processEvents();
217 } else { 217 } else {
218 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 218 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
219 finfo.setFile( oldFile ); 219 finfo.setFile( oldFile );
220 if (finfo.exists() ) { 220 if (finfo.exists() ) {
221 KMessageBox::information( this, message); 221 KMessageBox::information( this, message);
222 mView->openCalendar( oldFile ); 222 mView->openCalendar( oldFile );
223 qApp->processEvents(); 223 qApp->processEvents();
224 } 224 }
225 } 225 }
226 mView->saveCalendar( defaultFileName() ); 226 mView->saveCalendar( defaultFileName() );
227 newFile = true; 227 newFile = true;
228 } 228 }
229 229
230 QTime neededSaveTime = QDateTime::currentDateTime().time(); 230 QTime neededSaveTime = QDateTime::currentDateTime().time();
231 mView->openCalendar( defaultFileName() ); 231 mView->openCalendar( defaultFileName() );
232 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 232 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
233 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 233 qDebug("KO: Calendar loading time: %d ms",msNeeded );
234 234
235 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 235 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
236 KOPrefs::instance()->setAllDefaults(); 236 KOPrefs::instance()->setAllDefaults();
237 int count = mView->addCategories(); 237 int count = mView->addCategories();
238 } 238 }
239 processIncidenceSelection( 0 ); 239 processIncidenceSelection( 0 );
240 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 240 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
241 SLOT( processIncidenceSelection( Incidence * ) ) ); 241 SLOT( processIncidenceSelection( Incidence * ) ) );
242 connect( mView, SIGNAL( modifiedChanged( bool ) ), 242 connect( mView, SIGNAL( modifiedChanged( bool ) ),
243 SLOT( slotModifiedChanged( bool ) ) ); 243 SLOT( slotModifiedChanged( bool ) ) );
244 244
245 245
246 connect( mView, SIGNAL( tempDisableBR(bool) ), 246 connect( mView, SIGNAL( tempDisableBR(bool) ),
247 SLOT( disableBR(bool) ) ); 247 SLOT( disableBR(bool) ) );
248 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 248 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
249 mView->setModified( false ); 249 mView->setModified( false );
250 mBlockAtStartup = false; 250 mBlockAtStartup = false;
251 mView->setModified( false ); 251 mView->setModified( false );
252 setCentralWidget( mView ); 252 setCentralWidget( mView );
253 globalFlagBlockStartup = 0; 253 globalFlagBlockStartup = 0;
254 mView->show(); 254 mView->show();
255 delete splash; 255 delete splash;
256 if ( newFile ) 256 if ( newFile )
257 mView->updateConfig(); 257 mView->updateConfig();
258 // qApp->processEvents(); 258 // qApp->processEvents();
259 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 259 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
260 //fillSyncMenu(); 260 //fillSyncMenu();
261 261
262 262
263 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 263 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
264 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 264 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
265 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 265 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
266 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 266 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
267 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 267 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
268 mSyncManager->setDefaultFileName( defaultFileName()); 268 mSyncManager->setDefaultFileName( sentSyncFile());
269 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 269 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
270 mSyncManager->fillSyncMenu(); 270 mSyncManager->fillSyncMenu();
271 271
272 272
273 273
274 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 274 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
275 if ( showWarning ) { 275 if ( showWarning ) {
276 KMessageBox::information( this, 276 KMessageBox::information( this,
277 "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"); 277 "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");
278 qApp->processEvents(); 278 qApp->processEvents();
279 mView->dialogManager()->showSyncOptions(); 279 mView->dialogManager()->showSyncOptions();
280 } 280 }
281 281
282 //US listen for result adressed from Ka/Pi 282 //US listen for result adressed from Ka/Pi
283#ifndef DESKTOP_VERSION 283#ifndef DESKTOP_VERSION
284 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 284 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
285#endif 285#endif
286#ifndef DESKTOP_VERSION 286#ifndef DESKTOP_VERSION
287 infrared = 0; 287 infrared = 0;
288#endif 288#endif
289 updateWeek( mView->startDate() ); 289 updateWeek( mView->startDate() );
290 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 290 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
291 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 291 SLOT( updateWeekNum( const KCal::DateList & ) ) );
292 mBRdisabled = false; 292 mBRdisabled = false;
293 //toggleBeamReceive(); 293 //toggleBeamReceive();
294} 294}
295MainWindow::~MainWindow() 295MainWindow::~MainWindow()
296{ 296{
297 //qDebug("MainWindow::~MainWindow() "); 297 //qDebug("MainWindow::~MainWindow() ");
298 //save toolbar location 298 //save toolbar location
299 delete mCalendar; 299 delete mCalendar;
300 delete mSyncManager; 300 delete mSyncManager;
301#ifndef DESKTOP_VERSION 301#ifndef DESKTOP_VERSION
302 if ( infrared ) 302 if ( infrared )
303 delete infrared; 303 delete infrared;
304#endif 304#endif
305 305
306 306
307} 307}
308 308
309void MainWindow::disableBR(bool b) 309void MainWindow::disableBR(bool b)
310{ 310{
311#ifndef DESKTOP_VERSION 311#ifndef DESKTOP_VERSION
312 if ( b ) { 312 if ( b ) {
313 if ( infrared ) { 313 if ( infrared ) {
314 toggleBeamReceive(); 314 toggleBeamReceive();
315 mBRdisabled = true; 315 mBRdisabled = true;
316 } 316 }
317 mBRdisabled = true; 317 mBRdisabled = true;
318 } else { 318 } else {
319 if ( mBRdisabled ) { 319 if ( mBRdisabled ) {
320 mBRdisabled = false; 320 mBRdisabled = false;
321 //makes no sense,because other cal ap is probably running 321 //makes no sense,because other cal ap is probably running
322 // toggleBeamReceive(); 322 // toggleBeamReceive();
323 } 323 }
324 } 324 }
325#endif 325#endif
326 326
327} 327}
328bool MainWindow::beamReceiveEnabled() 328bool MainWindow::beamReceiveEnabled()
329{ 329{
330#ifndef DESKTOP_VERSION 330#ifndef DESKTOP_VERSION
331 return ( infrared != 0 ); 331 return ( infrared != 0 );
332#endif 332#endif
333 return false; 333 return false;
334} 334}
335 335
336void MainWindow::toggleBeamReceive() 336void MainWindow::toggleBeamReceive()
337{ 337{
338 if ( mBRdisabled ) 338 if ( mBRdisabled )
339 return; 339 return;
340#ifndef DESKTOP_VERSION 340#ifndef DESKTOP_VERSION
341 if ( infrared ) { 341 if ( infrared ) {
342 qDebug("disable BeamReceive "); 342 qDebug("disable BeamReceive ");
343 delete infrared; 343 delete infrared;
344 infrared = 0; 344 infrared = 0;
345 brAction->setOn(false); 345 brAction->setOn(false);
346 return; 346 return;
347 } 347 }
348 qDebug("enable BeamReceive "); 348 qDebug("enable BeamReceive ");
349 brAction->setOn(true); 349 brAction->setOn(true);
350 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 350 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
351 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 351 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
352#endif 352#endif
353} 353}
354void MainWindow::showMaximized () 354void MainWindow::showMaximized ()
355{ 355{
356#ifndef DESKTOP_VERSION 356#ifndef DESKTOP_VERSION
357 if ( ! globalFlagBlockStartup ) 357 if ( ! globalFlagBlockStartup )
358 if ( mClosed ) 358 if ( mClosed )
359 mView->goToday(); 359 mView->goToday();
360#endif 360#endif
361 QWidget::showMaximized () ; 361 QWidget::showMaximized () ;
362 mClosed = false; 362 mClosed = false;
363} 363}
364void MainWindow::closeEvent( QCloseEvent* ce ) 364void MainWindow::closeEvent( QCloseEvent* ce )
365{ 365{
366 366
367 367
368 368
369 if ( ! KOPrefs::instance()->mAskForQuit ) { 369 if ( ! KOPrefs::instance()->mAskForQuit ) {
370 saveOnClose(); 370 saveOnClose();
371 mClosed = true; 371 mClosed = true;
372 ce->accept(); 372 ce->accept();
373 return; 373 return;
374 374
375 } 375 }
376 376
377 switch( QMessageBox::information( this, "KO/Pi", 377 switch( QMessageBox::information( this, "KO/Pi",
378 i18n("Do you really want\nto close KO/Pi?"), 378 i18n("Do you really want\nto close KO/Pi?"),
379 i18n("Close"), i18n("No"), 379 i18n("Close"), i18n("No"),
380 0, 0 ) ) { 380 0, 0 ) ) {
381 case 0: 381 case 0:
382 saveOnClose(); 382 saveOnClose();
383 mClosed = true; 383 mClosed = true;
384 ce->accept(); 384 ce->accept();
385 break; 385 break;
386 case 1: 386 case 1:
387 ce->ignore(); 387 ce->ignore();
388 break; 388 break;
389 case 2: 389 case 2:
390 390
391 default: 391 default:
392 break; 392 break;
393 } 393 }
394 394
395 395
396} 396}
397 397
398void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 398void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
399{ 399{
400 QDataStream stream( data, IO_ReadOnly ); 400 QDataStream stream( data, IO_ReadOnly );
401 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 401 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
402 //QString datamess; 402 //QString datamess;
403 //qDebug("message "); 403 //qDebug("message ");
404 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 404 qDebug("KO: QCOP message received: %s ", cmsg.data() );
405 405
406 if ( cmsg == "setDocument(QString)" ) { 406 if ( cmsg == "setDocument(QString)" ) {
407 QDataStream stream( data, IO_ReadOnly ); 407 QDataStream stream( data, IO_ReadOnly );
408 QString fileName; 408 QString fileName;
409 stream >> fileName; 409 stream >> fileName;
410 //qDebug("filename %s ", fileName.latin1()); 410 //qDebug("filename %s ", fileName.latin1());
411 showMaximized(); 411 showMaximized();
412 raise(); 412 raise();
413 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 413 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
414 mSyncManager->slotSyncMenu( 1002 ); 414 mSyncManager->slotSyncMenu( 1002 );
415 return; 415 return;
416 } 416 }
417 417
418 if ( cmsg == "-writeFile" ) { 418 if ( cmsg == "-writeFile" ) {
419 // I made from the "-writeFile" an "-writeAlarm" 419 // I made from the "-writeFile" an "-writeAlarm"
420 mView->viewManager()->showWhatsNextView(); 420 mView->viewManager()->showWhatsNextView();
421 mCalendar->checkAlarmForIncidence( 0, true); 421 mCalendar->checkAlarmForIncidence( 0, true);
422 showMaximized(); 422 showMaximized();
423 raise(); 423 raise();
424 return; 424 return;
425 425
426 } 426 }
427 if ( cmsg == "-writeFileSilent" ) { 427 if ( cmsg == "-writeFileSilent" ) {
428 // I made from the "-writeFile" an "-writeAlarm" 428 // I made from the "-writeFile" an "-writeAlarm"
429 // mView->viewManager()->showWhatsNextView(); 429 // mView->viewManager()->showWhatsNextView();
430 mCalendar->checkAlarmForIncidence( 0, true); 430 mCalendar->checkAlarmForIncidence( 0, true);
431 //showMaximized(); 431 //showMaximized();
432 //raise(); 432 //raise();
433 hide(); 433 hide();
434 return; 434 return;
435 } 435 }
436 if ( cmsg == "-newCountdown" ) { 436 if ( cmsg == "-newCountdown" ) {
437 qDebug("newCountdown "); 437 qDebug("newCountdown ");
438 438
439 } 439 }
440 QString msg ; 440 QString msg ;
441 QString allmsg = cmsg; 441 QString allmsg = cmsg;
442 while ( allmsg.length() > 0 ) { 442 while ( allmsg.length() > 0 ) {
443 int nextC = allmsg.find( "-", 1 ); 443 int nextC = allmsg.find( "-", 1 );
444 if ( nextC == -1 ) { 444 if ( nextC == -1 ) {
445 msg = allmsg; 445 msg = allmsg;
446 allmsg = ""; 446 allmsg = "";
447 } else{ 447 } else{
448 msg = allmsg.left( nextC ); 448 msg = allmsg.left( nextC );
449 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 449 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
450 } 450 }
451 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 451 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
452 if ( msg == "-newEvent" ) { 452 if ( msg == "-newEvent" ) {
453 mView->newEvent(); 453 mView->newEvent();
454 } 454 }
455 if ( msg == "-newTodo" ) { 455 if ( msg == "-newTodo" ) {
456 mView->newTodo(); 456 mView->newTodo();
457 457
458 } 458 }
459 if ( msg == "-showWN" ) { 459 if ( msg == "-showWN" ) {
460 mView->viewManager()->showWhatsNextView(); 460 mView->viewManager()->showWhatsNextView();
461 } 461 }
462 if ( msg == "-showTodo" ) { 462 if ( msg == "-showTodo" ) {
463 mView->viewManager()->showTodoView(); 463 mView->viewManager()->showTodoView();
464 } 464 }
465 if ( msg == "-showList" ) { 465 if ( msg == "-showList" ) {
466 mView->viewManager()->showListView(); 466 mView->viewManager()->showListView();
467 } 467 }
468 else if ( msg == "-showDay" ) { 468 else if ( msg == "-showDay" ) {
469 mView->viewManager()->showDayView(); 469 mView->viewManager()->showDayView();
470 } 470 }
471 else if ( msg == "-showWWeek" ) { 471 else if ( msg == "-showWWeek" ) {
472 mView->viewManager()->showWorkWeekView(); 472 mView->viewManager()->showWorkWeekView();
473 } 473 }
474 else if ( msg == "-ringSync" ) { 474 else if ( msg == "-ringSync" ) {
475 mSyncManager->multiSync( false ); 475 mSyncManager->multiSync( false );
476 } 476 }
477 else if ( msg == "-showWeek" ) { 477 else if ( msg == "-showWeek" ) {
478 mView->viewManager()->showWeekView(); 478 mView->viewManager()->showWeekView();
479 } 479 }
480 else if ( msg == "-showTodo" ) { 480 else if ( msg == "-showTodo" ) {
481 mView->viewManager()->showTodoView(); 481 mView->viewManager()->showTodoView();
482 } 482 }
483 else if ( msg == "-showJournal" ) { 483 else if ( msg == "-showJournal" ) {
484 mView->dateNavigator()->selectDates( 1 ); 484 mView->dateNavigator()->selectDates( 1 );
485 mView->dateNavigator()->selectToday(); 485 mView->dateNavigator()->selectToday();
486 mView->viewManager()->showJournalView(); 486 mView->viewManager()->showJournalView();
487 } 487 }
488 else if ( msg == "-showKO" ) { 488 else if ( msg == "-showKO" ) {
489 mView->viewManager()->showNextXView(); 489 mView->viewManager()->showNextXView();
490 } 490 }
491 else if ( msg == "-showWNext" || msg == "nextView()" ) { 491 else if ( msg == "-showWNext" || msg == "nextView()" ) {
492 mView->viewManager()->showWhatsNextView(); 492 mView->viewManager()->showWhatsNextView();
493 } 493 }
494 else if ( msg == "-showNextXView" ) { 494 else if ( msg == "-showNextXView" ) {
495 mView->viewManager()->showNextXView(); 495 mView->viewManager()->showNextXView();
496 } 496 }
497 497
498 498
499 } 499 }
500 500
501 showMaximized(); 501 showMaximized();
502 raise(); 502 raise();
503} 503}
504 504
505QPixmap MainWindow::loadPixmap( QString name ) 505QPixmap MainWindow::loadPixmap( QString name )
506{ 506{
507 return SmallIcon( name ); 507 return SmallIcon( name );
508 508
509} 509}
510void MainWindow::initActions() 510void MainWindow::initActions()
511{ 511{
512 //KOPrefs::instance()->mShowFullMenu 512 //KOPrefs::instance()->mShowFullMenu
513 iconToolBar->clear(); 513 iconToolBar->clear();
514 KOPrefs *p = KOPrefs::instance(); 514 KOPrefs *p = KOPrefs::instance();
515 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 515 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
516 516
517 QPopupMenu *viewMenu = new QPopupMenu( this ); 517 QPopupMenu *viewMenu = new QPopupMenu( this );
518 QPopupMenu *actionMenu = new QPopupMenu( this ); 518 QPopupMenu *actionMenu = new QPopupMenu( this );
519 QPopupMenu *importMenu = new QPopupMenu( this ); 519 QPopupMenu *importMenu = new QPopupMenu( this );
520 selectFilterMenu = new QPopupMenu( this ); 520 selectFilterMenu = new QPopupMenu( this );
521 selectFilterMenu->setCheckable( true ); 521 selectFilterMenu->setCheckable( true );
522 syncMenu = new QPopupMenu( this ); 522 syncMenu = new QPopupMenu( this );
523 configureAgendaMenu = new QPopupMenu( this ); 523 configureAgendaMenu = new QPopupMenu( this );
524 configureToolBarMenu = new QPopupMenu( this ); 524 configureToolBarMenu = new QPopupMenu( this );
525 QPopupMenu *helpMenu = new QPopupMenu( this ); 525 QPopupMenu *helpMenu = new QPopupMenu( this );
526 if ( KOPrefs::instance()->mShowFullMenu ) { 526 if ( KOPrefs::instance()->mShowFullMenu ) {
527 QMenuBar *menuBar1; 527 QMenuBar *menuBar1;
528 menuBar1 = menuBar(); 528 menuBar1 = menuBar();
529 menuBar1->insertItem( i18n("File"), importMenu ); 529 menuBar1->insertItem( i18n("File"), importMenu );
530 menuBar1->insertItem( i18n("View"), viewMenu ); 530 menuBar1->insertItem( i18n("View"), viewMenu );
531 menuBar1->insertItem( i18n("Actions"), actionMenu ); 531 menuBar1->insertItem( i18n("Actions"), actionMenu );
532#ifdef DESKTOP_VERSION 532#ifdef DESKTOP_VERSION
533 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 533 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
534 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 534 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
535#else 535#else
536 menuBar1->insertItem( i18n("Sync"), syncMenu ); 536 menuBar1->insertItem( i18n("Sync"), syncMenu );
537 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 537 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
538#endif 538#endif
539 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 539 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
540 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 540 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
541 menuBar1->insertItem( i18n("Help"), helpMenu ); 541 menuBar1->insertItem( i18n("Help"), helpMenu );
542 } else { 542 } else {
543 QPEMenuBar *menuBar1; 543 QPEMenuBar *menuBar1;
544 menuBar1 = new QPEMenuBar( iconToolBar ); 544 menuBar1 = new QPEMenuBar( iconToolBar );
545 QPopupMenu *menuBar = new QPopupMenu( this ); 545 QPopupMenu *menuBar = new QPopupMenu( this );
546 menuBar1->insertItem( i18n("ME"), menuBar); 546 menuBar1->insertItem( i18n("ME"), menuBar);
547 menuBar->insertItem( i18n("File"), importMenu ); 547 menuBar->insertItem( i18n("File"), importMenu );
548 menuBar->insertItem( i18n("View"), viewMenu ); 548 menuBar->insertItem( i18n("View"), viewMenu );
549 menuBar->insertItem( i18n("Actions"), actionMenu ); 549 menuBar->insertItem( i18n("Actions"), actionMenu );
550 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 550 menuBar->insertItem( i18n("Synchronize"), syncMenu );
551 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 551 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
552 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 552 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
553 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 553 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
554 menuBar->insertItem( i18n("Help"), helpMenu ); 554 menuBar->insertItem( i18n("Help"), helpMenu );
555 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 555 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
556 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 556 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
557 } 557 }
558 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 558 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
559 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 559 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
560 QIconSet icon; 560 QIconSet icon;
561 int pixWid = 22, pixHei = 22; 561 int pixWid = 22, pixHei = 22;
562 QString pathString = ""; 562 QString pathString = "";
563 if ( !p->mToolBarMiniIcons ) { 563 if ( !p->mToolBarMiniIcons ) {
564 if ( QApplication::desktop()->width() < 480 ) { 564 if ( QApplication::desktop()->width() < 480 ) {
565 pathString += "icons16/"; 565 pathString += "icons16/";
566 pixWid = 18; pixHei = 16; 566 pixWid = 18; pixHei = 16;
567 } 567 }
568 } else { 568 } else {
569 pathString += "iconsmini/"; 569 pathString += "iconsmini/";
570 pixWid = 18; pixHei = 16; 570 pixWid = 18; pixHei = 16;
571 } 571 }
572 mWeekBgColor = iconToolBar->backgroundColor(); 572 mWeekBgColor = iconToolBar->backgroundColor();
573 mWeekPixmap.resize( pixWid , pixHei ); 573 mWeekPixmap.resize( pixWid , pixHei );
574 mWeekPixmap.fill( mWeekBgColor ); 574 mWeekPixmap.fill( mWeekBgColor );
575 icon = mWeekPixmap; 575 icon = mWeekPixmap;
576 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 576 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
577 mWeekAction->addTo( iconToolBar ); 577 mWeekAction->addTo( iconToolBar );
578 mWeekFont = font(); 578 mWeekFont = font();
579 579
580 int fontPoint = mWeekFont.pointSize(); 580 int fontPoint = mWeekFont.pointSize();
581 QFontMetrics f( mWeekFont ); 581 QFontMetrics f( mWeekFont );
582 int fontWid = f.width( "30" ); 582 int fontWid = f.width( "30" );
583 while ( fontWid > pixWid ) { 583 while ( fontWid > pixWid ) {
584 --fontPoint; 584 --fontPoint;
585 mWeekFont.setPointSize( fontPoint ); 585 mWeekFont.setPointSize( fontPoint );
586 QFontMetrics f( mWeekFont ); 586 QFontMetrics f( mWeekFont );
587 fontWid = f.width( "30" ); 587 fontWid = f.width( "30" );
588 qDebug("dec-- "); 588 qDebug("dec-- ");
589 } 589 }
590 590
591 connect( mWeekAction, SIGNAL( activated() ), 591 connect( mWeekAction, SIGNAL( activated() ),
592 this, SLOT( weekAction() ) ); 592 this, SLOT( weekAction() ) );
593 593
594 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 594 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
595 595
596 //#endif 596 //#endif
597 // ****************** 597 // ******************
598 QAction *action; 598 QAction *action;
599 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 599 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
600 configureToolBarMenu->setCheckable( true ); 600 configureToolBarMenu->setCheckable( true );
601 601
602 602
603 configureAgendaMenu->setCheckable( true ); 603 configureAgendaMenu->setCheckable( true );
604 int iii ; 604 int iii ;
605 for ( iii = 1;iii<= 10 ;++iii ){ 605 for ( iii = 1;iii<= 10 ;++iii ){
606 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 606 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
607 } 607 }
608 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 608 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
609 609
610 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 610 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
611 this, SLOT( showConfigureAgenda( ) ) ); 611 this, SLOT( showConfigureAgenda( ) ) );
612 612
613 icon = loadPixmap( pathString + "configure" ); 613 icon = loadPixmap( pathString + "configure" );
614 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 614 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
615 action->addTo( actionMenu ); 615 action->addTo( actionMenu );
616 connect( action, SIGNAL( activated() ), 616 connect( action, SIGNAL( activated() ),
617 mView, SLOT( edit_options() ) ); 617 mView, SLOT( edit_options() ) );
618 actionMenu->insertSeparator(); 618 actionMenu->insertSeparator();
619 619
620 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 620 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
621 action->addTo( actionMenu ); 621 action->addTo( actionMenu );
622 connect( action, SIGNAL( activated() ), 622 connect( action, SIGNAL( activated() ),
623 mView, SLOT( undo_delete() ) ); 623 mView, SLOT( undo_delete() ) );
624 actionMenu->insertSeparator(); 624 actionMenu->insertSeparator();
625 625
626 icon = loadPixmap( pathString + "newevent" ); 626 icon = loadPixmap( pathString + "newevent" );
627 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 627 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
628 configureToolBarMenu->insertSeparator(); 628 configureToolBarMenu->insertSeparator();
629 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 629 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
630 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 630 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
631 ne_action->addTo( actionMenu ); 631 ne_action->addTo( actionMenu );
632 connect( ne_action, SIGNAL( activated() ), 632 connect( ne_action, SIGNAL( activated() ),
633 mView, SLOT( newEvent() ) ); 633 mView, SLOT( newEvent() ) );
634 icon = loadPixmap( pathString + "newtodo" ); 634 icon = loadPixmap( pathString + "newtodo" );
635 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 635 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
636 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 636 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
637 nt_action->addTo( actionMenu ); 637 nt_action->addTo( actionMenu );
638 connect( nt_action, SIGNAL( activated() ), 638 connect( nt_action, SIGNAL( activated() ),
639 mView, SLOT( newTodo() ) ); 639 mView, SLOT( newTodo() ) );
640 640
641 icon = loadPixmap( pathString + "today" ); 641 icon = loadPixmap( pathString + "today" );
642 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 642 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
643 today_action->addTo( viewMenu ); 643 today_action->addTo( viewMenu );
644 connect( today_action, SIGNAL( activated() ), 644 connect( today_action, SIGNAL( activated() ),
645 mView, SLOT( goToday() ) ); 645 mView, SLOT( goToday() ) );
646 viewMenu->insertSeparator(); 646 viewMenu->insertSeparator();
647 647
648 icon = loadPixmap( pathString + "navi" ); 648 icon = loadPixmap( pathString + "navi" );
649 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 649 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
650 action->addTo( viewMenu ); 650 action->addTo( viewMenu );
651 connect( action, SIGNAL( activated() ), 651 connect( action, SIGNAL( activated() ),
652 mView, SLOT( toggleDateNavigatorWidget() ) ); 652 mView, SLOT( toggleDateNavigatorWidget() ) );
653 mToggleNav = action ; 653 mToggleNav = action ;
654 icon = loadPixmap( pathString + "filter" ); 654 icon = loadPixmap( pathString + "filter" );
655 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 655 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
656 action->addTo( viewMenu ); 656 action->addTo( viewMenu );
657 connect( action, SIGNAL( activated() ), 657 connect( action, SIGNAL( activated() ),
658 mView, SLOT( toggleFilter() ) ); 658 mView, SLOT( toggleFilter() ) );
659 mToggleFilter = action; 659 mToggleFilter = action;
660 icon = loadPixmap( pathString + "allday" ); 660 icon = loadPixmap( pathString + "allday" );
661 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 661 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
662 action->addTo( viewMenu ); 662 action->addTo( viewMenu );
663 connect( action, SIGNAL( activated() ), 663 connect( action, SIGNAL( activated() ),
664 mView, SLOT( toggleAllDaySize() ) ); 664 mView, SLOT( toggleAllDaySize() ) );
665 mToggleAllday = action; 665 mToggleAllday = action;
666 666
667 667
668 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 668 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
669 mToggleNav, SLOT( setEnabled ( bool ) ) ); 669 mToggleNav, SLOT( setEnabled ( bool ) ) );
670 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 670 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
671 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 671 mToggleFilter, SLOT( setEnabled ( bool ) ) );
672 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 672 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
673 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 673 mToggleAllday, SLOT( setEnabled ( bool ) ) );
674 674
675 viewMenu->insertSeparator(); 675 viewMenu->insertSeparator();
676 icon = loadPixmap( pathString + "picker" ); 676 icon = loadPixmap( pathString + "picker" );
677 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 677 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
678 action->addTo( viewMenu ); 678 action->addTo( viewMenu );
679 connect( action, SIGNAL( activated() ), 679 connect( action, SIGNAL( activated() ),
680 mView, SLOT( showDatePicker() ) ); 680 mView, SLOT( showDatePicker() ) );
681 action->addTo( iconToolBar ); 681 action->addTo( iconToolBar );
682 viewMenu->insertSeparator(); 682 viewMenu->insertSeparator();
683 icon = loadPixmap( pathString + "list" ); 683 icon = loadPixmap( pathString + "list" );
684 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 684 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
685 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 685 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
686 showlist_action->addTo( viewMenu ); 686 showlist_action->addTo( viewMenu );
687 connect( showlist_action, SIGNAL( activated() ), 687 connect( showlist_action, SIGNAL( activated() ),
688 mView->viewManager(), SLOT( showListView() ) ); 688 mView->viewManager(), SLOT( showListView() ) );
689 689
690 690
691 icon = loadPixmap( pathString + "day" ); 691 icon = loadPixmap( pathString + "day" );
692 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 692 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
693 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 693 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
694 day1_action->addTo( viewMenu ); 694 day1_action->addTo( viewMenu );
695 // action->addTo( toolBar ); 695 // action->addTo( toolBar );
696 connect( day1_action, SIGNAL( activated() ), 696 connect( day1_action, SIGNAL( activated() ),
697 mView->viewManager(), SLOT( showDayView() ) ); 697 mView->viewManager(), SLOT( showDayView() ) );
698 698
699 icon = loadPixmap( pathString + "workweek" ); 699 icon = loadPixmap( pathString + "workweek" );
700 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 700 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
701 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 701 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
702 day5_action->addTo( viewMenu ); 702 day5_action->addTo( viewMenu );
703 connect( day5_action, SIGNAL( activated() ), 703 connect( day5_action, SIGNAL( activated() ),
704 mView->viewManager(), SLOT( showWorkWeekView() ) ); 704 mView->viewManager(), SLOT( showWorkWeekView() ) );
705 705
706 icon = loadPixmap( pathString + "week" ); 706 icon = loadPixmap( pathString + "week" );
707 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 707 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
708 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 708 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
709 day7_action->addTo( viewMenu ); 709 day7_action->addTo( viewMenu );
710 connect( day7_action, SIGNAL( activated() ), 710 connect( day7_action, SIGNAL( activated() ),
711 mView->viewManager(), SLOT( showWeekView() ) ); 711 mView->viewManager(), SLOT( showWeekView() ) );
712 712
713 icon = loadPixmap( pathString + "month" ); 713 icon = loadPixmap( pathString + "month" );
714 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 714 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
715 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 715 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
716 month_action->addTo( viewMenu ); 716 month_action->addTo( viewMenu );
717 connect( month_action, SIGNAL( activated() ), 717 connect( month_action, SIGNAL( activated() ),
718 mView->viewManager(), SLOT( showMonthView() ) ); 718 mView->viewManager(), SLOT( showMonthView() ) );
719 719
720 icon = loadPixmap( pathString + "todo" ); 720 icon = loadPixmap( pathString + "todo" );
721 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 721 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
722 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 722 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
723 todoview_action->addTo( viewMenu ); 723 todoview_action->addTo( viewMenu );
724 connect( todoview_action, SIGNAL( activated() ), 724 connect( todoview_action, SIGNAL( activated() ),
725 mView->viewManager(), SLOT( showTodoView() ) ); 725 mView->viewManager(), SLOT( showTodoView() ) );
726 726
727 icon = loadPixmap( pathString + "journal" ); 727 icon = loadPixmap( pathString + "journal" );
728 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 728 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
729 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 729 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
730 viewjournal_action->addTo( viewMenu ); 730 viewjournal_action->addTo( viewMenu );
731 connect( viewjournal_action, SIGNAL( activated() ), 731 connect( viewjournal_action, SIGNAL( activated() ),
732 mView->viewManager(), SLOT( showJournalView() ) ); 732 mView->viewManager(), SLOT( showJournalView() ) );
733 733
734 icon = loadPixmap( pathString + "xdays" ); 734 icon = loadPixmap( pathString + "xdays" );
735 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 735 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
736 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 736 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
737 xdays_action->addTo( viewMenu ); 737 xdays_action->addTo( viewMenu );
738 connect( xdays_action, SIGNAL( activated() ), 738 connect( xdays_action, SIGNAL( activated() ),
739 mView->viewManager(), SLOT( showNextXView() ) ); 739 mView->viewManager(), SLOT( showNextXView() ) );
740 740
741 icon = loadPixmap( pathString + "whatsnext" ); 741 icon = loadPixmap( pathString + "whatsnext" );
742 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 742 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
743 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 743 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
744 whatsnext_action->addTo( viewMenu ); 744 whatsnext_action->addTo( viewMenu );
745 connect( whatsnext_action, SIGNAL( activated() ), 745 connect( whatsnext_action, SIGNAL( activated() ),
746 mView->viewManager(), SLOT( showWhatsNextView() ) ); 746 mView->viewManager(), SLOT( showWhatsNextView() ) );
747 747
748#if 0 748#if 0
749 action = new QAction( "view_timespan", "Time Span", 0, this ); 749 action = new QAction( "view_timespan", "Time Span", 0, this );
750 action->addTo( viewMenu ); 750 action->addTo( viewMenu );
751 connect( action, SIGNAL( activated() ), 751 connect( action, SIGNAL( activated() ),
752 mView->viewManager(), SLOT( showTimeSpanView() ) ); 752 mView->viewManager(), SLOT( showTimeSpanView() ) );
753#endif 753#endif
754 754
755 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 755 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
756 this ); 756 this );
757 mNewSubTodoAction->addTo( actionMenu ); 757 mNewSubTodoAction->addTo( actionMenu );
758 connect( mNewSubTodoAction, SIGNAL( activated() ), 758 connect( mNewSubTodoAction, SIGNAL( activated() ),
759 mView, SLOT( newSubTodo() ) ); 759 mView, SLOT( newSubTodo() ) );
760 760
761 actionMenu->insertSeparator(); 761 actionMenu->insertSeparator();
762 762
763 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 763 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
764 mShowAction->addTo( actionMenu ); 764 mShowAction->addTo( actionMenu );
765 connect( mShowAction, SIGNAL( activated() ), 765 connect( mShowAction, SIGNAL( activated() ),
766 mView, SLOT( showIncidence() ) ); 766 mView, SLOT( showIncidence() ) );
767 767
768 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 768 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
769 mEditAction->addTo( actionMenu ); 769 mEditAction->addTo( actionMenu );
770 connect( mEditAction, SIGNAL( activated() ), 770 connect( mEditAction, SIGNAL( activated() ),
771 mView, SLOT( editIncidence() ) ); 771 mView, SLOT( editIncidence() ) );
772 772
773 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 773 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
774 mDeleteAction->addTo( actionMenu ); 774 mDeleteAction->addTo( actionMenu );
775 connect( mDeleteAction, SIGNAL( activated() ), 775 connect( mDeleteAction, SIGNAL( activated() ),
776 mView, SLOT( deleteIncidence() ) ); 776 mView, SLOT( deleteIncidence() ) );
777 777
778 778
779 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 779 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
780 mCloneAction->addTo( actionMenu ); 780 mCloneAction->addTo( actionMenu );
781 connect( mCloneAction, SIGNAL( activated() ), 781 connect( mCloneAction, SIGNAL( activated() ),
782 mView, SLOT( cloneIncidence() ) ); 782 mView, SLOT( cloneIncidence() ) );
783 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 783 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
784 mMoveAction->addTo( actionMenu ); 784 mMoveAction->addTo( actionMenu );
785 connect( mMoveAction, SIGNAL( activated() ), 785 connect( mMoveAction, SIGNAL( activated() ),
786 mView, SLOT( moveIncidence() ) ); 786 mView, SLOT( moveIncidence() ) );
787 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 787 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
788 mBeamAction->addTo( actionMenu ); 788 mBeamAction->addTo( actionMenu );
789 connect( mBeamAction, SIGNAL( activated() ), 789 connect( mBeamAction, SIGNAL( activated() ),
790 mView, SLOT( beamIncidence() ) ); 790 mView, SLOT( beamIncidence() ) );
791 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 791 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
792 mCancelAction->addTo( actionMenu ); 792 mCancelAction->addTo( actionMenu );
793 connect( mCancelAction, SIGNAL( activated() ), 793 connect( mCancelAction, SIGNAL( activated() ),
794 mView, SLOT( toggleCancelIncidence() ) ); 794 mView, SLOT( toggleCancelIncidence() ) );
795 795
796 actionMenu->insertSeparator(); 796 actionMenu->insertSeparator();
797 797
798 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 798 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
799 this ); 799 this );
800 action->addTo( actionMenu ); 800 action->addTo( actionMenu );
801 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 801 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
802 802
803 icon = loadPixmap( pathString + "search" ); 803 icon = loadPixmap( pathString + "search" );
804 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 804 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
805 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 805 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
806 search_action->addTo( actionMenu ); 806 search_action->addTo( actionMenu );
807 connect( search_action, SIGNAL( activated() ), 807 connect( search_action, SIGNAL( activated() ),
808 mView->dialogManager(), SLOT( showSearchDialog() ) ); 808 mView->dialogManager(), SLOT( showSearchDialog() ) );
809 809
810 810
811 811
812 if ( KOPrefs::instance()->mShowFullMenu ) { 812 if ( KOPrefs::instance()->mShowFullMenu ) {
813 actionMenu->insertSeparator(); 813 actionMenu->insertSeparator();
814 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 814 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
815 815
816 } 816 }
817 // actionMenu->insertSeparator(); 817 // actionMenu->insertSeparator();
818 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 818 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
819 this ); 819 this );
820 action->addTo( importMenu ); 820 action->addTo( importMenu );
821 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 821 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
822 action = new QAction( "import_quick", i18n("Import last file"), 0, 822 action = new QAction( "import_quick", i18n("Import last file"), 0,
823 this ); 823 this );
824 action->addTo( importMenu ); 824 action->addTo( importMenu );
825 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 825 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
826 importMenu->insertSeparator(); 826 importMenu->insertSeparator();
827 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 827 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
828 this ); 828 this );
829 action->addTo( importMenu ); 829 action->addTo( importMenu );
830 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 830 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
831#ifndef DESKTOP_VERSION 831#ifndef DESKTOP_VERSION
832 importMenu->insertSeparator(); 832 importMenu->insertSeparator();
833 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 833 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
834 this ); 834 this );
835 action->addTo( importMenu ); 835 action->addTo( importMenu );
836 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 836 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
837#else 837#else
838#ifdef _OL_IMPORT_ 838#ifdef _OL_IMPORT_
839 importMenu->insertSeparator(); 839 importMenu->insertSeparator();
840 action = new QAction( "import_ol", i18n("Import from OL"), 0, 840 action = new QAction( "import_ol", i18n("Import from OL"), 0,
841 this ); 841 this );
842 action->addTo( importMenu ); 842 action->addTo( importMenu );
843 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 843 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
844#endif 844#endif
845#endif 845#endif
846 846
847 importMenu->insertSeparator(); 847 importMenu->insertSeparator();
848 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 848 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
849 this ); 849 this );
850 action->addTo( importMenu ); 850 action->addTo( importMenu );
851 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 851 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
852 852
853 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 853 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
854 this ); 854 this );
855 action->addTo( importMenu ); 855 action->addTo( importMenu );
856 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 856 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
857 857
858 importMenu->insertSeparator(); 858 importMenu->insertSeparator();
859 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 859 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
860 this ); 860 this );
861 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 861 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
862 862
863 863
864 //LR 864 //LR
865 QPopupMenu *ex2phone = new QPopupMenu( this ); 865 QPopupMenu *ex2phone = new QPopupMenu( this );
866 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 866 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
867 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 867 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
868 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 868 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
869 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 869 importMenu->insertItem( i18n("Export to phone"), ex2phone );
870 870
871 importMenu->insertSeparator(); 871 importMenu->insertSeparator();
872 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 872 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
873 this ); 873 this );
874 action->addTo( importMenu ); 874 action->addTo( importMenu );
875 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 875 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
876#ifndef DESKTOP_VERSION 876#ifndef DESKTOP_VERSION
877 importMenu->insertSeparator(); 877 importMenu->insertSeparator();
878 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 878 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
879 this ); 879 this );
880 brAction->addTo( importMenu ); 880 brAction->addTo( importMenu );
881 brAction->setToggleAction (true ) ; 881 brAction->setToggleAction (true ) ;
882 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 882 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
883 883
884 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 884 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
885 this ); 885 this );
886 action->addTo( importMenu ); 886 action->addTo( importMenu );
887 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 887 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
888 888
889 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 889 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
890 this ); 890 this );
891 action->addTo( importMenu ); 891 action->addTo( importMenu );
892 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 892 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
893#else 893#else
894 importMenu->insertSeparator(); 894 importMenu->insertSeparator();
895 icon = loadPixmap( pathString + "print" ); 895 icon = loadPixmap( pathString + "print" );
896 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 896 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
897 action->addTo( importMenu ); 897 action->addTo( importMenu );
898 connect( action, SIGNAL( activated() ), 898 connect( action, SIGNAL( activated() ),
899 this, SLOT( printCal() ) ); 899 this, SLOT( printCal() ) );
900 900
901 icon = loadPixmap( pathString + "print" ); 901 icon = loadPixmap( pathString + "print" );
902 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 902 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
903 action->addTo( importMenu ); 903 action->addTo( importMenu );
904 connect( action, SIGNAL( activated() ), 904 connect( action, SIGNAL( activated() ),
905 this, SLOT( printSel() ) ); 905 this, SLOT( printSel() ) );
906 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 906 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
907 action->addTo( importMenu ); 907 action->addTo( importMenu );
908 connect( action, SIGNAL( activated() ), 908 connect( action, SIGNAL( activated() ),
909 mView->viewManager(), SIGNAL( printWNV() ) ); 909 mView->viewManager(), SIGNAL( printWNV() ) );
910#endif 910#endif
911 importMenu->insertSeparator(); 911 importMenu->insertSeparator();
912 action = new QAction( "beam all", i18n("Save"), 0, 912 action = new QAction( "beam all", i18n("Save"), 0,
913 this ); 913 this );
914 action->addTo( importMenu ); 914 action->addTo( importMenu );
915 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 915 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
916 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 916 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
917 this ); 917 this );
918 action->addTo( importMenu ); 918 action->addTo( importMenu );
919 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 919 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
920 920
921 //menuBar->insertItem( "Configure",configureMenu ); 921 //menuBar->insertItem( "Configure",configureMenu );
922 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 922 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
923 icon = loadPixmap( "korganizer/korganizer" ); 923 icon = loadPixmap( "korganizer/korganizer" );
924 924
925 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 925 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
926 action->addTo( helpMenu ); 926 action->addTo( helpMenu );
927 connect( action, SIGNAL( activated() ), 927 connect( action, SIGNAL( activated() ),
928 SLOT( whatsNew() ) ); 928 SLOT( whatsNew() ) );
929 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 929 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
930 action->addTo( helpMenu ); 930 action->addTo( helpMenu );
931 connect( action, SIGNAL( activated() ), 931 connect( action, SIGNAL( activated() ),
932 SLOT( features() ) ); 932 SLOT( features() ) );
933 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 933 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
934 action->addTo( helpMenu ); 934 action->addTo( helpMenu );
935 connect( action, SIGNAL( activated() ), 935 connect( action, SIGNAL( activated() ),
936 SLOT( keyBindings() ) ); 936 SLOT( keyBindings() ) );
937 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 937 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
938 action->addTo( helpMenu ); 938 action->addTo( helpMenu );
939 connect( action, SIGNAL( activated() ), 939 connect( action, SIGNAL( activated() ),
940 SLOT( synchowto() ) ); 940 SLOT( synchowto() ) );
941 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 941 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
942 action->addTo( helpMenu ); 942 action->addTo( helpMenu );
943 connect( action, SIGNAL( activated() ), 943 connect( action, SIGNAL( activated() ),
944 SLOT( kdesynchowto() ) ); 944 SLOT( kdesynchowto() ) );
945 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 945 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
946 action->addTo( helpMenu ); 946 action->addTo( helpMenu );
947 connect( action, SIGNAL( activated() ), 947 connect( action, SIGNAL( activated() ),
948 SLOT( multisynchowto() ) ); 948 SLOT( multisynchowto() ) );
949 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 949 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
950 action->addTo( helpMenu ); 950 action->addTo( helpMenu );
951 connect( action, SIGNAL( activated() ), 951 connect( action, SIGNAL( activated() ),
952 SLOT( aboutAutoSaving() ) ); 952 SLOT( aboutAutoSaving() ) );
953 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 953 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
954 action->addTo( helpMenu ); 954 action->addTo( helpMenu );
955 connect( action, SIGNAL( activated() ), 955 connect( action, SIGNAL( activated() ),
956 SLOT( aboutKnownBugs() ) ); 956 SLOT( aboutKnownBugs() ) );
957 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 957 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
958 action->addTo( helpMenu ); 958 action->addTo( helpMenu );
959 connect( action, SIGNAL( activated() ), 959 connect( action, SIGNAL( activated() ),
960 SLOT( usertrans() ) ); 960 SLOT( usertrans() ) );
961 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 961 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
962 action->addTo( helpMenu ); 962 action->addTo( helpMenu );
963 connect( action, SIGNAL( activated() ), 963 connect( action, SIGNAL( activated() ),
964 SLOT( faq() ) ); 964 SLOT( faq() ) );
965 action = new QAction( "licence", i18n("Licence..."), 0, this ); 965 action = new QAction( "licence", i18n("Licence..."), 0, this );
966 action->addTo( helpMenu ); 966 action->addTo( helpMenu );
967 connect( action, SIGNAL( activated() ), 967 connect( action, SIGNAL( activated() ),
968 SLOT( licence() ) ); 968 SLOT( licence() ) );
969 action = new QAction( "about", i18n("About..."), 0, this ); 969 action = new QAction( "about", i18n("About..."), 0, this );
970 action->addTo( helpMenu ); 970 action->addTo( helpMenu );
971 connect( action, SIGNAL( activated() ), 971 connect( action, SIGNAL( activated() ),
972 SLOT( about() ) ); 972 SLOT( about() ) );
973 //menuBar->insertSeparator(); 973 //menuBar->insertSeparator();
974 974
975 // ****************************************************** 975 // ******************************************************
976 // menubar icons 976 // menubar icons
977 977
978 978
979 iconToolBar->setHorizontalStretchable (true ); 979 iconToolBar->setHorizontalStretchable (true );
980 //menuBar->insertItem( iconToolBar ); 980 //menuBar->insertItem( iconToolBar );
981 //xdays_action 981 //xdays_action
982 if (p-> mShowIconNewEvent) 982 if (p-> mShowIconNewEvent)
983 ne_action->addTo( iconToolBar ); 983 ne_action->addTo( iconToolBar );
984 if (p->mShowIconNewTodo ) 984 if (p->mShowIconNewTodo )
985 nt_action->addTo( iconToolBar ); 985 nt_action->addTo( iconToolBar );
986 if (p-> mShowIconSearch) 986 if (p-> mShowIconSearch)
987 search_action->addTo( iconToolBar ); 987 search_action->addTo( iconToolBar );
988 if (p-> mShowIconNext) 988 if (p-> mShowIconNext)
989 whatsnext_action->addTo( iconToolBar ); 989 whatsnext_action->addTo( iconToolBar );
990 if (p-> mShowIconNextDays) 990 if (p-> mShowIconNextDays)
991 xdays_action->addTo( iconToolBar ); 991 xdays_action->addTo( iconToolBar );
992 if (p-> mShowIconList) 992 if (p-> mShowIconList)
993 showlist_action->addTo( iconToolBar ); 993 showlist_action->addTo( iconToolBar );
994 if (p-> mShowIconDay1) 994 if (p-> mShowIconDay1)
995 day1_action->addTo( iconToolBar ); 995 day1_action->addTo( iconToolBar );
996 if (p-> mShowIconDay5) 996 if (p-> mShowIconDay5)
997 day5_action->addTo( iconToolBar ); 997 day5_action->addTo( iconToolBar );
998 if (p-> mShowIconDay7) 998 if (p-> mShowIconDay7)
999 day7_action->addTo( iconToolBar ); 999 day7_action->addTo( iconToolBar );
1000 if (p-> mShowIconMonth) 1000 if (p-> mShowIconMonth)
1001 month_action->addTo( iconToolBar ); 1001 month_action->addTo( iconToolBar );
1002 if (p-> mShowIconTodoview) 1002 if (p-> mShowIconTodoview)
1003 todoview_action->addTo( iconToolBar ); 1003 todoview_action->addTo( iconToolBar );
1004 if (p-> mShowIconJournal) 1004 if (p-> mShowIconJournal)
1005 viewjournal_action->addTo( iconToolBar ); 1005 viewjournal_action->addTo( iconToolBar );
1006 icon = loadPixmap( pathString + "2leftarrowB" ); 1006 icon = loadPixmap( pathString + "2leftarrowB" );
1007 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1007 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
1008 if (p-> mShowIconBackFast) { 1008 if (p-> mShowIconBackFast) {
1009 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1009 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1010 connect( action, SIGNAL( activated() ), 1010 connect( action, SIGNAL( activated() ),
1011 mView, SLOT( goPreviousMonth() ) ); 1011 mView, SLOT( goPreviousMonth() ) );
1012 action->addTo( iconToolBar ); 1012 action->addTo( iconToolBar );
1013 } 1013 }
1014 icon = loadPixmap( pathString + "1leftarrowB" ); 1014 icon = loadPixmap( pathString + "1leftarrowB" );
1015 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1015 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
1016 if (p-> mShowIconBack) { 1016 if (p-> mShowIconBack) {
1017 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1017 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1018 connect( action, SIGNAL( activated() ), 1018 connect( action, SIGNAL( activated() ),
1019 mView, SLOT( goPrevious() ) ); 1019 mView, SLOT( goPrevious() ) );
1020 action->addTo( iconToolBar ); 1020 action->addTo( iconToolBar );
1021 } 1021 }
1022 icon = loadPixmap( pathString + "today" ); 1022 icon = loadPixmap( pathString + "today" );
1023 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1023 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1024 if (p-> mShowIconToday) 1024 if (p-> mShowIconToday)
1025 today_action->addTo( iconToolBar ); 1025 today_action->addTo( iconToolBar );
1026 icon = loadPixmap( pathString + "1rightarrowB" ); 1026 icon = loadPixmap( pathString + "1rightarrowB" );
1027 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1027 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1028 if (p-> mShowIconForward) { 1028 if (p-> mShowIconForward) {
1029 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1029 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1030 connect( action, SIGNAL( activated() ), 1030 connect( action, SIGNAL( activated() ),
1031 mView, SLOT( goNext() ) ); 1031 mView, SLOT( goNext() ) );
1032 action->addTo( iconToolBar ); 1032 action->addTo( iconToolBar );
1033 } 1033 }
1034 icon = loadPixmap( pathString + "2rightarrowB" ); 1034 icon = loadPixmap( pathString + "2rightarrowB" );
1035 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1035 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1036 if (p-> mShowIconForwardFast) { 1036 if (p-> mShowIconForwardFast) {
1037 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1037 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1038 connect( action, SIGNAL( activated() ), 1038 connect( action, SIGNAL( activated() ),
1039 mView, SLOT( goNextMonth() ) ); 1039 mView, SLOT( goNextMonth() ) );
1040 action->addTo( iconToolBar ); 1040 action->addTo( iconToolBar );
1041 } 1041 }
1042 1042
1043 1043
1044 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1044 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1045 1045
1046 if (p-> mShowIconNewEvent) 1046 if (p-> mShowIconNewEvent)
1047 configureToolBarMenu->setItemChecked( 10, true ); 1047 configureToolBarMenu->setItemChecked( 10, true );
1048 if (p->mShowIconNewTodo ) 1048 if (p->mShowIconNewTodo )
1049 configureToolBarMenu->setItemChecked( 20, true ); 1049 configureToolBarMenu->setItemChecked( 20, true );
1050 if (p-> mShowIconSearch) 1050 if (p-> mShowIconSearch)
1051 configureToolBarMenu->setItemChecked( 120, true ); 1051 configureToolBarMenu->setItemChecked( 120, true );
1052 if (p-> mShowIconList) 1052 if (p-> mShowIconList)
1053 configureToolBarMenu->setItemChecked( 30, true ); 1053 configureToolBarMenu->setItemChecked( 30, true );
1054 if (p-> mShowIconDay1) 1054 if (p-> mShowIconDay1)
1055 configureToolBarMenu->setItemChecked( 40, true ); 1055 configureToolBarMenu->setItemChecked( 40, true );
1056 if (p-> mShowIconDay5) 1056 if (p-> mShowIconDay5)
1057 configureToolBarMenu->setItemChecked( 50, true ); 1057 configureToolBarMenu->setItemChecked( 50, true );
1058 if (p-> mShowIconDay7) 1058 if (p-> mShowIconDay7)
1059 configureToolBarMenu->setItemChecked( 60, true ); 1059 configureToolBarMenu->setItemChecked( 60, true );
1060 if (p-> mShowIconMonth) 1060 if (p-> mShowIconMonth)
1061 configureToolBarMenu->setItemChecked( 70, true ); 1061 configureToolBarMenu->setItemChecked( 70, true );
1062 if (p-> mShowIconTodoview) 1062 if (p-> mShowIconTodoview)
1063 configureToolBarMenu->setItemChecked( 80, true ); 1063 configureToolBarMenu->setItemChecked( 80, true );
1064 if (p-> mShowIconBackFast) 1064 if (p-> mShowIconBackFast)
1065 configureToolBarMenu->setItemChecked( 200, true ); 1065 configureToolBarMenu->setItemChecked( 200, true );
1066 if (p-> mShowIconBack) 1066 if (p-> mShowIconBack)
1067 configureToolBarMenu->setItemChecked( 210, true ); 1067 configureToolBarMenu->setItemChecked( 210, true );
1068 if (p-> mShowIconToday) 1068 if (p-> mShowIconToday)
1069 configureToolBarMenu->setItemChecked( 130, true ); 1069 configureToolBarMenu->setItemChecked( 130, true );
1070 if (p-> mShowIconForward) 1070 if (p-> mShowIconForward)
1071 configureToolBarMenu->setItemChecked( 220, true ); 1071 configureToolBarMenu->setItemChecked( 220, true );
1072 if (p-> mShowIconForwardFast) 1072 if (p-> mShowIconForwardFast)
1073 configureToolBarMenu->setItemChecked( 230, true ); 1073 configureToolBarMenu->setItemChecked( 230, true );
1074 if (p-> mShowIconNextDays) 1074 if (p-> mShowIconNextDays)
1075 configureToolBarMenu->setItemChecked( 100, true ); 1075 configureToolBarMenu->setItemChecked( 100, true );
1076 if (p-> mShowIconNext) 1076 if (p-> mShowIconNext)
1077 configureToolBarMenu->setItemChecked( 110, true ); 1077 configureToolBarMenu->setItemChecked( 110, true );
1078 if (p-> mShowIconJournal) 1078 if (p-> mShowIconJournal)
1079 configureToolBarMenu->setItemChecked( 90, true ); 1079 configureToolBarMenu->setItemChecked( 90, true );
1080 if (p-> mShowIconWhatsThis) 1080 if (p-> mShowIconWhatsThis)
1081 configureToolBarMenu->setItemChecked( 300, true ); 1081 configureToolBarMenu->setItemChecked( 300, true );
1082 1082
1083 QLabel* dummy = new QLabel( iconToolBar ); 1083 QLabel* dummy = new QLabel( iconToolBar );
1084 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1084 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1085 if (!p-> mShowIconStretch) 1085 if (!p-> mShowIconStretch)
1086 iconToolBar->setStretchableWidget ( dummy ) ; 1086 iconToolBar->setStretchableWidget ( dummy ) ;
1087 else 1087 else
1088 configureToolBarMenu->setItemChecked( 5, true ); 1088 configureToolBarMenu->setItemChecked( 5, true );
1089 if (p-> mShowIconWhatsThis) 1089 if (p-> mShowIconWhatsThis)
1090 QWhatsThis::whatsThisButton ( iconToolBar ); 1090 QWhatsThis::whatsThisButton ( iconToolBar );
1091 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1091 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1092 configureAgenda( p->mHourSize ); 1092 configureAgenda( p->mHourSize );
1093 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1093 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1094} 1094}
1095 1095
1096void MainWindow::exportToPhone( int mode ) 1096void MainWindow::exportToPhone( int mode )
1097{ 1097{
1098 1098
1099 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1099 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1100 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1100 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1101 KOex2phonePrefs ex2phone; 1101 KOex2phonePrefs ex2phone;
1102 1102
1103 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1103 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1104 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1104 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1105 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1105 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1106 if ( mode == 1 ) 1106 if ( mode == 1 )
1107 ex2phone.setCaption(i18n("Export complete calendar")); 1107 ex2phone.setCaption(i18n("Export complete calendar"));
1108 if ( mode == 2 ) 1108 if ( mode == 2 )
1109 ex2phone.setCaption(i18n("Export filtered calendar")); 1109 ex2phone.setCaption(i18n("Export filtered calendar"));
1110 1110
1111 if ( !ex2phone.exec() ) { 1111 if ( !ex2phone.exec() ) {
1112 return; 1112 return;
1113 } 1113 }
1114 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1114 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1115 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1115 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1116 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1116 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1117 1117
1118 int inFuture = 0; 1118 int inFuture = 0;
1119 if ( ex2phone.mWriteBackFuture->isChecked() ) 1119 if ( ex2phone.mWriteBackFuture->isChecked() )
1120 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1120 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1121 QPtrList<Incidence> delSel; 1121 QPtrList<Incidence> delSel;
1122 if ( mode == 1 ) 1122 if ( mode == 1 )
1123 delSel = mCalendar->rawIncidences(); 1123 delSel = mCalendar->rawIncidences();
1124 if ( mode == 2 ) 1124 if ( mode == 2 )
1125 delSel = mCalendar->incidences(); 1125 delSel = mCalendar->incidences();
1126 CalendarLocal* cal = new CalendarLocal(); 1126 CalendarLocal* cal = new CalendarLocal();
1127 cal->setLocalTime(); 1127 cal->setLocalTime();
1128 Incidence *incidence = delSel.first(); 1128 Incidence *incidence = delSel.first();
1129 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1129 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1130 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1130 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1131 while ( incidence ) { 1131 while ( incidence ) {
1132 if ( incidence->type() != "Journal" ) { 1132 if ( incidence->type() != "Journal" ) {
1133 bool add = true; 1133 bool add = true;
1134 if ( inFuture ) { 1134 if ( inFuture ) {
1135 QDateTime dt; 1135 QDateTime dt;
1136 if ( incidence->type() == "Todo" ) { 1136 if ( incidence->type() == "Todo" ) {
1137 Todo * t = (Todo*)incidence; 1137 Todo * t = (Todo*)incidence;
1138 if ( t->hasDueDate() ) 1138 if ( t->hasDueDate() )
1139 dt = t->dtDue(); 1139 dt = t->dtDue();
1140 else 1140 else
1141 dt = cur.addSecs( 62 ); 1141 dt = cur.addSecs( 62 );
1142 } 1142 }
1143 else { 1143 else {
1144 bool ok; 1144 bool ok;
1145 dt = incidence->getNextOccurence( cur, &ok ); 1145 dt = incidence->getNextOccurence( cur, &ok );
1146 if ( !ok ) 1146 if ( !ok )
1147 dt = cur.addSecs( -62 ); 1147 dt = cur.addSecs( -62 );
1148 } 1148 }
1149 if ( dt < cur || dt > end ) { 1149 if ( dt < cur || dt > end ) {
1150 add = false; 1150 add = false;
1151 } 1151 }
1152 } 1152 }
1153 if ( add ) { 1153 if ( add ) {
1154 Incidence *in = incidence->clone(); 1154 Incidence *in = incidence->clone();
1155 cal->addIncidence( in ); 1155 cal->addIncidence( in );
1156 } 1156 }
1157 } 1157 }
1158 incidence = delSel.next(); 1158 incidence = delSel.next();
1159 } 1159 }
1160 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1160 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1161 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1161 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1162 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1162 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1163 1163
1164 setCaption( i18n("Writing to phone...")); 1164 setCaption( i18n("Writing to phone..."));
1165 if ( PhoneFormat::writeToPhone( cal ) ) 1165 if ( PhoneFormat::writeToPhone( cal ) )
1166 setCaption( i18n("Export to phone successful!")); 1166 setCaption( i18n("Export to phone successful!"));
1167 else 1167 else
1168 setCaption( i18n("Error exporting to phone!")); 1168 setCaption( i18n("Error exporting to phone!"));
1169 delete cal; 1169 delete cal;
1170} 1170}
1171 1171
1172 1172
1173void MainWindow::setDefaultPreferences() 1173void MainWindow::setDefaultPreferences()
1174{ 1174{
1175 KOPrefs *p = KOPrefs::instance(); 1175 KOPrefs *p = KOPrefs::instance();
1176 1176
1177 p->mCompactDialogs = true; 1177 p->mCompactDialogs = true;
1178 p->mConfirm = true; 1178 p->mConfirm = true;
1179 // p->mEnableQuickTodo = false; 1179 // p->mEnableQuickTodo = false;
1180 1180
1181} 1181}
1182 1182
1183QString MainWindow::resourcePath() 1183QString MainWindow::resourcePath()
1184{ 1184{
1185 return KGlobal::iconLoader()->iconPath(); 1185 return KGlobal::iconLoader()->iconPath();
1186} 1186}
1187 1187
1188void MainWindow::displayText( QString text ,QString cap ) 1188void MainWindow::displayText( QString text ,QString cap )
1189{ 1189{
1190 QDialog dia( this, "name", true ); ; 1190 QDialog dia( this, "name", true ); ;
1191 dia.setCaption( cap ); 1191 dia.setCaption( cap );
1192 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1192 QVBoxLayout* lay = new QVBoxLayout( &dia );
1193 lay->setSpacing( 3 ); 1193 lay->setSpacing( 3 );
1194 lay->setMargin( 3 ); 1194 lay->setMargin( 3 );
1195 QTextBrowser tb ( &dia ); 1195 QTextBrowser tb ( &dia );
1196 lay->addWidget( &tb ); 1196 lay->addWidget( &tb );
1197 tb.setText( text ); 1197 tb.setText( text );
1198#ifdef DESKTOP_VERSION 1198#ifdef DESKTOP_VERSION
1199 dia.resize( 640, 480); 1199 dia.resize( 640, 480);
1200#else 1200#else
1201 dia.showMaximized(); 1201 dia.showMaximized();
1202#endif 1202#endif
1203 dia.exec(); 1203 dia.exec();
1204} 1204}
1205 1205
1206void MainWindow::features() 1206void MainWindow::features()
1207{ 1207{
1208 1208
1209 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1209 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1210} 1210}
1211 1211
1212void MainWindow::usertrans() 1212void MainWindow::usertrans()
1213{ 1213{
1214 1214
1215 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1215 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1216} 1216}
1217 1217
1218void MainWindow::kdesynchowto() 1218void MainWindow::kdesynchowto()
1219{ 1219{
1220 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1220 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1221} 1221}
1222void MainWindow::multisynchowto() 1222void MainWindow::multisynchowto()
1223{ 1223{
1224 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1224 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1225} 1225}
1226void MainWindow::synchowto() 1226void MainWindow::synchowto()
1227{ 1227{
1228 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1228 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1229} 1229}
1230void MainWindow::faq() 1230void MainWindow::faq()
1231{ 1231{
1232 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1232 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1233 1233
1234} 1234}
1235void MainWindow::whatsNew() 1235void MainWindow::whatsNew()
1236{ 1236{
1237 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1237 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1238 1238
1239} 1239}
1240void MainWindow::licence() 1240void MainWindow::licence()
1241{ 1241{
1242 KApplication::showLicence(); 1242 KApplication::showLicence();
1243 1243
1244} 1244}
1245void MainWindow::about() 1245void MainWindow::about()
1246{ 1246{
1247 QString version; 1247 QString version;
1248#include <../version> 1248#include <../version>
1249 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1249 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1250 i18n("KOrganizer/Platform-independent\n") + 1250 i18n("KOrganizer/Platform-independent\n") +
1251 "(KO/Pi) " + version + " - " + 1251 "(KO/Pi) " + version + " - " +
1252 1252
1253#ifdef DESKTOP_VERSION 1253#ifdef DESKTOP_VERSION
1254 i18n("Desktop Edition\n") + 1254 i18n("Desktop Edition\n") +
1255#else 1255#else
1256 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1256 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1257#endif 1257#endif
1258 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!") ); 1258 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!") );
1259} 1259}
1260void MainWindow::keyBindings() 1260void MainWindow::keyBindings()
1261{ 1261{
1262 QString cap = i18n("KO/Pi Keys + Colors"); 1262 QString cap = i18n("KO/Pi Keys + Colors");
1263 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1263 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1264 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1264 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1265 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1265 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1266 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1266 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1267 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1267 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1268 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1268 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1269 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1269 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1270 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1270 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1271 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1271 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1272 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1272 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1273 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1273 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1274 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1274 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1275 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1275 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1276 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1276 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1277 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1277 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1278 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1278 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1279 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1279 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1280 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1280 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1281 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1281 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1282 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1282 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1283 i18n("<p><h3>In agenda view:</h3></p>\n") + 1283 i18n("<p><h3>In agenda view:</h3></p>\n") +
1284 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1284 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1285 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1285 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1286 i18n("<p><h3>In todo view:</h3></p>\n") + 1286 i18n("<p><h3>In todo view:</h3></p>\n") +
1287 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1287 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1288 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1288 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1289 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1289 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1290 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1290 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1291 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1291 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1292 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1292 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1293 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1293 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1294 i18n("<p><h3>In list view:</h3></p>\n") + 1294 i18n("<p><h3>In list view:</h3></p>\n") +
1295 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1295 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1296 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1296 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1297 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1297 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1298 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1298 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1299 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1299 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1300 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1300 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1301 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1301 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1302 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1302 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1303 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1303 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1304 i18n("<p><b>E</b>: Edit item</p>\n") + 1304 i18n("<p><b>E</b>: Edit item</p>\n") +
1305 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1305 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1306 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1306 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1307 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1307 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1308 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1308 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1309 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1309 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1310 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1310 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1311 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1311 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1312 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1312 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1313 i18n("<p><b>White</b>: Item readonly</p>\n"); 1313 i18n("<p><b>White</b>: Item readonly</p>\n");
1314 displayText( text, cap); 1314 displayText( text, cap);
1315} 1315}
1316void MainWindow::aboutAutoSaving() 1316void MainWindow::aboutAutoSaving()
1317{ 1317{
1318 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"); 1318 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");
1319 1319
1320 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1320 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1321 1321
1322} 1322}
1323void MainWindow::aboutKnownBugs() 1323void MainWindow::aboutKnownBugs()
1324{ 1324{
1325 QMessageBox* msg; 1325 QMessageBox* msg;
1326 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1326 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1327 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")+ 1327 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")+
1328 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1328 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1329 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1329 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1330 i18n("\nor report them in the bugtracker on\n") + 1330 i18n("\nor report them in the bugtracker on\n") +
1331 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1331 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1332 QMessageBox::NoIcon, 1332 QMessageBox::NoIcon,
1333 QMessageBox::Ok, 1333 QMessageBox::Ok,
1334 QMessageBox::NoButton, 1334 QMessageBox::NoButton,
1335 QMessageBox::NoButton); 1335 QMessageBox::NoButton);
1336 msg->exec(); 1336 msg->exec();
1337 delete msg; 1337 delete msg;
1338 1338
1339} 1339}
1340 1340
1341QString MainWindow::defaultFileName() 1341QString MainWindow::defaultFileName()
1342{ 1342{
1343 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1343 return locateLocal( "data", "korganizer/mycalendar.ics" );
1344} 1344}
1345QString MainWindow::syncFileName() 1345QString MainWindow::syncFileName()
1346{ 1346{
1347#ifdef DESKTOP_VERSION 1347#ifdef DESKTOP_VERSION
1348 return locateLocal( "tmp", "synccalendar.ics" ); 1348 return locateLocal( "tmp", "synccalendar.ics" );
1349#else 1349#else
1350 return QString( "/tmp/synccalendar.ics" ); 1350 return QString( "/tmp/synccalendar.ics" );
1351#endif 1351#endif
1352} 1352}
1353void MainWindow::updateWeek(QDate seda) 1353void MainWindow::updateWeek(QDate seda)
1354{ 1354{
1355 int weekNum = 0; 1355 int weekNum = 0;
1356 QDate d = QDate ( seda.year(), 1,1); 1356 QDate d = QDate ( seda.year(), 1,1);
1357 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1357 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1358 if ( seda.addDays(6).year() != seda.year() ) { 1358 if ( seda.addDays(6).year() != seda.year() ) {
1359 if ( seda.year() != d.year() ) { 1359 if ( seda.year() != d.year() ) {
1360 if ( d.dayOfWeek() > 4 ) 1360 if ( d.dayOfWeek() > 4 )
1361 d = QDate ( seda.year(), 1,1); 1361 d = QDate ( seda.year(), 1,1);
1362 else 1362 else
1363 weekNum = 1; 1363 weekNum = 1;
1364 } else { 1364 } else {
1365 QDate dd( seda.year()+1, 1,1); 1365 QDate dd( seda.year()+1, 1,1);
1366 if ( dd.dayOfWeek() <= 4 ) 1366 if ( dd.dayOfWeek() <= 4 )
1367 weekNum = 1; 1367 weekNum = 1;
1368 } 1368 }
1369 } 1369 }
1370 if ( weekNum == 0 ){ 1370 if ( weekNum == 0 ){
1371 int dow = d.dayOfWeek(); 1371 int dow = d.dayOfWeek();
1372 if ( dow <= 4 ) 1372 if ( dow <= 4 )
1373 d = d.addDays( 1-dow ); 1373 d = d.addDays( 1-dow );
1374 else // 5,6,7 1374 else // 5,6,7
1375 d = d.addDays( 8-dow ); 1375 d = d.addDays( 8-dow );
1376 // we have the first week of the year.we are on monday 1376 // we have the first week of the year.we are on monday
1377 weekNum = d.daysTo( seda ) / 7 +1; 1377 weekNum = d.daysTo( seda ) / 7 +1;
1378 } 1378 }
1379 1379
1380 mWeekPixmap.fill( mWeekBgColor ); 1380 mWeekPixmap.fill( mWeekBgColor );
1381 QPainter p ( &mWeekPixmap ); 1381 QPainter p ( &mWeekPixmap );
1382 p.setFont( mWeekFont ); 1382 p.setFont( mWeekFont );
1383 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1383 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1384 p.end(); 1384 p.end();
1385 QIconSet icon3 ( mWeekPixmap ); 1385 QIconSet icon3 ( mWeekPixmap );
1386 mWeekAction->setIconSet ( icon3 ); 1386 mWeekAction->setIconSet ( icon3 );
1387 1387
1388} 1388}
1389void MainWindow::updateWeekNum(const DateList &selectedDates) 1389void MainWindow::updateWeekNum(const DateList &selectedDates)
1390{ 1390{
1391 updateWeek( selectedDates.first() ); 1391 updateWeek( selectedDates.first() );
1392} 1392}
1393void MainWindow::processIncidenceSelection( Incidence *incidence ) 1393void MainWindow::processIncidenceSelection( Incidence *incidence )
1394{ 1394{
1395 1395
1396 if ( !incidence ) { 1396 if ( !incidence ) {
1397 enableIncidenceActions( false ); 1397 enableIncidenceActions( false );
1398 1398
1399 mNewSubTodoAction->setEnabled( false ); 1399 mNewSubTodoAction->setEnabled( false );
1400 setCaptionToDates(); 1400 setCaptionToDates();
1401 return; 1401 return;
1402 1402
1403 } 1403 }
1404 1404
1405 //KGlobal::locale()->formatDateTime(nextA, true); 1405 //KGlobal::locale()->formatDateTime(nextA, true);
1406 QString startString = ""; 1406 QString startString = "";
1407 if ( incidence->type() != "Todo" ) { 1407 if ( incidence->type() != "Todo" ) {
1408 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1408 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1409 if ( incidence->doesFloat() ) { 1409 if ( incidence->doesFloat() ) {
1410 startString += ": "+incidence->dtStartDateStr( true ); 1410 startString += ": "+incidence->dtStartDateStr( true );
1411 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1411 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1412 1412
1413 } else { 1413 } else {
1414 startString = ": "+incidence->dtStartStr(true); 1414 startString = ": "+incidence->dtStartStr(true);
1415 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1415 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1416 1416
1417 } 1417 }
1418 1418
1419 } else { 1419 } else {
1420 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1420 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1421 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1421 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1422 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1422 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1423 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1423 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1424 bool ok; 1424 bool ok;
1425 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1425 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1426 if ( ok ) { 1426 if ( ok ) {
1427 int years = noc.date().year() - incidence->dtStart().date().year(); 1427 int years = noc.date().year() - incidence->dtStart().date().year();
1428 startString += i18n(" (%1 y.)"). arg( years ); 1428 startString += i18n(" (%1 y.)"). arg( years );
1429 } 1429 }
1430 } 1430 }
1431 else 1431 else
1432 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1432 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1433 } 1433 }
1434 1434
1435 } 1435 }
1436 else 1436 else
1437 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1437 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1438 if ( !incidence->location().isEmpty() ) 1438 if ( !incidence->location().isEmpty() )
1439 startString += " (" +incidence->location()+")"; 1439 startString += " (" +incidence->location()+")";
1440 setCaption( incidence->summary()+startString); 1440 setCaption( incidence->summary()+startString);
1441 1441
1442 enableIncidenceActions( true ); 1442 enableIncidenceActions( true );
1443 1443
1444 if ( incidence->type() == "Event" ) { 1444 if ( incidence->type() == "Event" ) {
1445 mShowAction->setText( i18n("Show Event...") ); 1445 mShowAction->setText( i18n("Show Event...") );
1446 mEditAction->setText( i18n("Edit Event...") ); 1446 mEditAction->setText( i18n("Edit Event...") );
1447 mDeleteAction->setText( i18n("Delete Event...") ); 1447 mDeleteAction->setText( i18n("Delete Event...") );
1448 1448
1449 mNewSubTodoAction->setEnabled( false ); 1449 mNewSubTodoAction->setEnabled( false );
1450 } else if ( incidence->type() == "Todo" ) { 1450 } else if ( incidence->type() == "Todo" ) {
1451 mShowAction->setText( i18n("Show Todo...") ); 1451 mShowAction->setText( i18n("Show Todo...") );
1452 mEditAction->setText( i18n("Edit Todo...") ); 1452 mEditAction->setText( i18n("Edit Todo...") );
1453 mDeleteAction->setText( i18n("Delete Todo...") ); 1453 mDeleteAction->setText( i18n("Delete Todo...") );
1454 1454
1455 mNewSubTodoAction->setEnabled( true ); 1455 mNewSubTodoAction->setEnabled( true );
1456 } else { 1456 } else {
1457 mShowAction->setText( i18n("Show...") ); 1457 mShowAction->setText( i18n("Show...") );
1458 mShowAction->setText( i18n("Edit...") ); 1458 mShowAction->setText( i18n("Edit...") );
1459 mShowAction->setText( i18n("Delete...") ); 1459 mShowAction->setText( i18n("Delete...") );
1460 1460
1461 mNewSubTodoAction->setEnabled( false ); 1461 mNewSubTodoAction->setEnabled( false );
1462 } 1462 }
1463} 1463}
1464 1464
1465void MainWindow::enableIncidenceActions( bool enabled ) 1465void MainWindow::enableIncidenceActions( bool enabled )
1466{ 1466{
1467 mShowAction->setEnabled( enabled ); 1467 mShowAction->setEnabled( enabled );
1468 mEditAction->setEnabled( enabled ); 1468 mEditAction->setEnabled( enabled );
1469 mDeleteAction->setEnabled( enabled ); 1469 mDeleteAction->setEnabled( enabled );
1470 1470
1471 mCloneAction->setEnabled( enabled ); 1471 mCloneAction->setEnabled( enabled );
1472 mMoveAction->setEnabled( enabled ); 1472 mMoveAction->setEnabled( enabled );
1473 mBeamAction->setEnabled( enabled ); 1473 mBeamAction->setEnabled( enabled );
1474 mCancelAction->setEnabled( enabled ); 1474 mCancelAction->setEnabled( enabled );
1475} 1475}
1476 1476
1477void MainWindow::importOL() 1477void MainWindow::importOL()
1478{ 1478{
1479#ifdef _OL_IMPORT_ 1479#ifdef _OL_IMPORT_
1480 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1480 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1481 id->exec(); 1481 id->exec();
1482 delete id; 1482 delete id;
1483 mView->updateView(); 1483 mView->updateView();
1484#endif 1484#endif
1485} 1485}
1486void MainWindow::importBday() 1486void MainWindow::importBday()
1487{ 1487{
1488 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1488 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1489 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1489 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1490 i18n("Import!"), i18n("Cancel"), 0, 1490 i18n("Import!"), i18n("Cancel"), 0,
1491 0, 1 ); 1491 0, 1 );
1492 if ( result == 0 ) { 1492 if ( result == 0 ) {
1493 mView->importBday(); 1493 mView->importBday();
1494 1494
1495 } 1495 }
1496 1496
1497 1497
1498} 1498}
1499void MainWindow::importQtopia() 1499void MainWindow::importQtopia()
1500{ 1500{
1501#ifndef DESKTOP_VERSION 1501#ifndef DESKTOP_VERSION
1502 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1502 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1503 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"), 1503 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"),
1504 i18n("Import!"), i18n("Cancel"), 0, 1504 i18n("Import!"), i18n("Cancel"), 0,
1505 0, 1 ); 1505 0, 1 );
1506 if ( result == 0 ) { 1506 if ( result == 0 ) {
1507 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1507 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1508 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1508 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1509 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1509 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1510 mView->importQtopia( categories, datebook, todolist ); 1510 mView->importQtopia( categories, datebook, todolist );
1511 } 1511 }
1512#else 1512#else
1513 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1513 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1514 i18n("Not supported \non desktop!\n"), 1514 i18n("Not supported \non desktop!\n"),
1515 i18n("Ok"), i18n("Cancel"), 0, 1515 i18n("Ok"), i18n("Cancel"), 0,
1516 0, 1 ); 1516 0, 1 );
1517 1517
1518#endif 1518#endif
1519} 1519}
1520 1520
1521void MainWindow::saveOnClose() 1521void MainWindow::saveOnClose()
1522{ 1522{
1523 KOPrefs *p = KOPrefs::instance(); 1523 KOPrefs *p = KOPrefs::instance();
1524 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1524 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1525 p->mToolBarUp = iconToolBar->x() > width()/2 || 1525 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1526 iconToolBar->y() > height()/2; 1526 iconToolBar->y() > height()/2;
1527 mView->writeSettings(); 1527 mView->writeSettings();
1528 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1528 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1529 save(); 1529 save();
1530} 1530}
1531void MainWindow::slotModifiedChanged( bool changed ) 1531void MainWindow::slotModifiedChanged( bool changed )
1532{ 1532{
1533 if ( mBlockAtStartup ) 1533 if ( mBlockAtStartup )
1534 return; 1534 return;
1535 1535
1536 int msec; 1536 int msec;
1537 // we store the changes after 1 minute, 1537 // we store the changes after 1 minute,
1538 // and for safety reasons after 10 minutes again 1538 // and for safety reasons after 10 minutes again
1539 if ( !mSyncManager->blockSave() ) 1539 if ( !mSyncManager->blockSave() )
1540 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1540 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1541 else 1541 else
1542 msec = 1000 * 600; 1542 msec = 1000 * 600;
1543 mSaveTimer.start( msec, true ); // 1 minute 1543 mSaveTimer.start( msec, true ); // 1 minute
1544 qDebug("KO: Saving File in %d secs!", msec/1000); 1544 qDebug("KO: Saving File in %d secs!", msec/1000);
1545 mCalendarModifiedFlag = true; 1545 mCalendarModifiedFlag = true;
1546} 1546}
1547void MainWindow::saveStopTimer() 1547void MainWindow::saveStopTimer()
1548{ 1548{
1549 mSaveTimer.stop(); 1549 mSaveTimer.stop();
1550 if (mSaveTimer.isActive() ) 1550 if (mSaveTimer.isActive() )
1551 qDebug("ti active "); 1551 qDebug("ti active ");
1552 else 1552 else
1553 qDebug("KO: Save timer stopped"); 1553 qDebug("KO: Save timer stopped");
1554} 1554}
1555void MainWindow::save() 1555void MainWindow::save()
1556{ 1556{
1557 if ( !mCalendarModifiedFlag ) { 1557 if ( !mCalendarModifiedFlag ) {
1558 qDebug("KO: Calendar not modified. Nothing saved."); 1558 qDebug("KO: Calendar not modified. Nothing saved.");
1559 return; 1559 return;
1560 } 1560 }
1561 if ( mSyncManager->blockSave() ) 1561 if ( mSyncManager->blockSave() )
1562 return; 1562 return;
1563 mSyncManager->setBlockSave(true); 1563 mSyncManager->setBlockSave(true);
1564 if ( mView->checkFileVersion( defaultFileName()) ) { 1564 if ( mView->checkFileVersion( defaultFileName()) ) {
1565 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1565 QTime neededSaveTime = QDateTime::currentDateTime().time();
1566 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1566 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1567 qDebug("KO: Start saving data to file!"); 1567 qDebug("KO: Start saving data to file!");
1568 mView->saveCalendar( defaultFileName() ); 1568 mView->saveCalendar( defaultFileName() );
1569 mCalendarModifiedFlag = false; 1569 mCalendarModifiedFlag = false;
1570 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1570 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1571 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1571 qDebug("KO: Needed %d ms for saving.",msNeeded );
1572 QString savemes; 1572 QString savemes;
1573 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1573 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1574 setCaption(savemes); 1574 setCaption(savemes);
1575 } else 1575 } else
1576 setCaption(i18n("Saving cancelled!")); 1576 setCaption(i18n("Saving cancelled!"));
1577 mSyncManager->setBlockSave( false ); 1577 mSyncManager->setBlockSave( false );
1578} 1578}
1579 1579
1580void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1580void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1581{ 1581{
1582 if ( !e->isAutoRepeat() ) { 1582 if ( !e->isAutoRepeat() ) {
1583 mFlagKeyPressed = false; 1583 mFlagKeyPressed = false;
1584 } 1584 }
1585} 1585}
1586void MainWindow::keyPressEvent ( QKeyEvent * e ) 1586void MainWindow::keyPressEvent ( QKeyEvent * e )
1587{ 1587{
1588 qApp->processEvents(); 1588 qApp->processEvents();
1589 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1589 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1590 e->ignore(); 1590 e->ignore();
1591 // qDebug(" ignore %d",e->isAutoRepeat() ); 1591 // qDebug(" ignore %d",e->isAutoRepeat() );
1592 return; 1592 return;
1593 } 1593 }
1594 if (! e->isAutoRepeat() ) 1594 if (! e->isAutoRepeat() )
1595 mFlagKeyPressed = true; 1595 mFlagKeyPressed = true;
1596 KOPrefs *p = KOPrefs::instance(); 1596 KOPrefs *p = KOPrefs::instance();
1597 bool showSelectedDates = false; 1597 bool showSelectedDates = false;
1598 int size; 1598 int size;
1599 int pro = 0; 1599 int pro = 0;
1600 //qDebug("MainWindow::keyPressEvent "); 1600 //qDebug("MainWindow::keyPressEvent ");
1601 switch ( e->key() ) { 1601 switch ( e->key() ) {
1602 case Qt::Key_Right: 1602 case Qt::Key_Right:
1603 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1603 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1604 mView->goNextMonth(); 1604 mView->goNextMonth();
1605 else 1605 else
1606 mView->goNext(); 1606 mView->goNext();
1607 showSelectedDates = true; 1607 showSelectedDates = true;
1608 break; 1608 break;
1609 case Qt::Key_Left: 1609 case Qt::Key_Left:
1610 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1610 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1611 mView->goPreviousMonth(); 1611 mView->goPreviousMonth();
1612 else 1612 else
1613 mView->goPrevious(); 1613 mView->goPrevious();
1614 showSelectedDates = true; 1614 showSelectedDates = true;
1615 break; 1615 break;
1616 case Qt::Key_Down: 1616 case Qt::Key_Down:
1617 mView->viewManager()->agendaView()->scrollOneHourDown(); 1617 mView->viewManager()->agendaView()->scrollOneHourDown();
1618 break; 1618 break;
1619 case Qt::Key_Up: 1619 case Qt::Key_Up:
1620 mView->viewManager()->agendaView()->scrollOneHourUp(); 1620 mView->viewManager()->agendaView()->scrollOneHourUp();
1621 break; 1621 break;
1622 case Qt::Key_I: 1622 case Qt::Key_I:
1623 mView->showIncidence(); 1623 mView->showIncidence();
1624 break; 1624 break;
1625 case Qt::Key_Delete: 1625 case Qt::Key_Delete:
1626 case Qt::Key_Backspace: 1626 case Qt::Key_Backspace:
1627 mView->deleteIncidence(); 1627 mView->deleteIncidence();
1628 break; 1628 break;
1629 case Qt::Key_D: 1629 case Qt::Key_D:
1630 mView->viewManager()->showDayView(); 1630 mView->viewManager()->showDayView();
1631 showSelectedDates = true; 1631 showSelectedDates = true;
1632 break; 1632 break;
1633 case Qt::Key_O: 1633 case Qt::Key_O:
1634 mView->toggleFilerEnabled( ); 1634 mView->toggleFilerEnabled( );
1635 break; 1635 break;
1636 case Qt::Key_0: 1636 case Qt::Key_0:
1637 case Qt::Key_1: 1637 case Qt::Key_1:
1638 case Qt::Key_2: 1638 case Qt::Key_2:
1639 case Qt::Key_3: 1639 case Qt::Key_3:
1640 case Qt::Key_4: 1640 case Qt::Key_4:
1641 case Qt::Key_5: 1641 case Qt::Key_5:
1642 case Qt::Key_6: 1642 case Qt::Key_6:
1643 case Qt::Key_7: 1643 case Qt::Key_7:
1644 case Qt::Key_8: 1644 case Qt::Key_8:
1645 case Qt::Key_9: 1645 case Qt::Key_9:
1646 pro = e->key()-48; 1646 pro = e->key()-48;
1647 if ( pro == 0 ) 1647 if ( pro == 0 )
1648 pro = 10; 1648 pro = 10;
1649 if ( e->state() == Qt::ControlButton) 1649 if ( e->state() == Qt::ControlButton)
1650 pro += 10; 1650 pro += 10;
1651 break; 1651 break;
1652 case Qt::Key_M: 1652 case Qt::Key_M:
1653 mView->viewManager()->showMonthView(); 1653 mView->viewManager()->showMonthView();
1654 showSelectedDates = true; 1654 showSelectedDates = true;
1655 break; 1655 break;
1656 case Qt::Key_Insert: 1656 case Qt::Key_Insert:
1657 mView->newEvent(); 1657 mView->newEvent();
1658 break; 1658 break;
1659 case Qt::Key_S : 1659 case Qt::Key_S :
1660 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1660 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1661 mView->newSubTodo(); 1661 mView->newSubTodo();
1662 else 1662 else
1663 mView->dialogManager()->showSearchDialog(); 1663 mView->dialogManager()->showSearchDialog();
1664 break; 1664 break;
1665 case Qt::Key_Y : 1665 case Qt::Key_Y :
1666 case Qt::Key_Z : 1666 case Qt::Key_Z :
1667 mView->viewManager()->showWorkWeekView(); 1667 mView->viewManager()->showWorkWeekView();
1668 showSelectedDates = true; 1668 showSelectedDates = true;
1669 break; 1669 break;
1670 case Qt::Key_U : 1670 case Qt::Key_U :
1671 mView->viewManager()->showWeekView(); 1671 mView->viewManager()->showWeekView();
1672 showSelectedDates = true; 1672 showSelectedDates = true;
1673 break; 1673 break;
1674 case Qt::Key_H : 1674 case Qt::Key_H :
1675 keyBindings(); 1675 keyBindings();
1676 break; 1676 break;
1677 case Qt::Key_W: 1677 case Qt::Key_W:
1678 mView->viewManager()->showWhatsNextView(); 1678 mView->viewManager()->showWhatsNextView();
1679 break; 1679 break;
1680 case Qt::Key_L: 1680 case Qt::Key_L:
1681 mView->viewManager()->showListView(); 1681 mView->viewManager()->showListView();
1682 break; 1682 break;
1683 case Qt::Key_N: 1683 case Qt::Key_N:
1684 mView->viewManager()->showNextXView(); 1684 mView->viewManager()->showNextXView();
1685 showSelectedDates = true; 1685 showSelectedDates = true;
1686 break; 1686 break;
1687 case Qt::Key_V: 1687 case Qt::Key_V:
1688 mView->viewManager()->showTodoView(); 1688 mView->viewManager()->showTodoView();
1689 break; 1689 break;
1690 case Qt::Key_C: 1690 case Qt::Key_C:
1691 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1691 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1692 break; 1692 break;
1693 case Qt::Key_P: 1693 case Qt::Key_P:
1694 mView->showDatePicker( ); 1694 mView->showDatePicker( );
1695 break; 1695 break;
1696 case Qt::Key_F: 1696 case Qt::Key_F:
1697 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1697 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1698 mView->editFilters(); 1698 mView->editFilters();
1699 else 1699 else
1700 mView->toggleFilter(); 1700 mView->toggleFilter();
1701 break; 1701 break;
1702 case Qt::Key_X: 1702 case Qt::Key_X:
1703 mView->toggleDateNavigatorWidget(); 1703 mView->toggleDateNavigatorWidget();
1704 break; 1704 break;
1705 case Qt::Key_Space: 1705 case Qt::Key_Space:
1706 mView->toggleExpand(); 1706 mView->toggleExpand();
1707 break; 1707 break;
1708 case Qt::Key_A: 1708 case Qt::Key_A:
1709 mView->toggleAllDaySize(); 1709 mView->toggleAllDaySize();
1710 break; 1710 break;
1711 case Qt::Key_T: 1711 case Qt::Key_T:
1712 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1712 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1713 mView->newTodo(); 1713 mView->newTodo();
1714 else { 1714 else {
1715 mView->goToday(); 1715 mView->goToday();
1716 showSelectedDates = true; 1716 showSelectedDates = true;
1717 } 1717 }
1718 break; 1718 break;
1719 case Qt::Key_J: 1719 case Qt::Key_J:
1720 mView->viewManager()->showJournalView(); 1720 mView->viewManager()->showJournalView();
1721 break; 1721 break;
1722 case Qt::Key_B: 1722 case Qt::Key_B:
1723 mView->editIncidenceDescription();; 1723 mView->editIncidenceDescription();;
1724 break; 1724 break;
1725 // case Qt::Key_Return: 1725 // case Qt::Key_Return:
1726 case Qt::Key_E: 1726 case Qt::Key_E:
1727 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1727 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1728 mView->newEvent(); 1728 mView->newEvent();
1729 else 1729 else
1730 mView->editIncidence(); 1730 mView->editIncidence();
1731 break; 1731 break;
1732 case Qt::Key_Plus: 1732 case Qt::Key_Plus:
1733 size = p->mHourSize +2; 1733 size = p->mHourSize +2;
1734 if ( size <= 22 ) 1734 if ( size <= 22 )
1735 configureAgenda( size ); 1735 configureAgenda( size );
1736 break; 1736 break;
1737 case Qt::Key_Minus: 1737 case Qt::Key_Minus:
1738 size = p->mHourSize - 2; 1738 size = p->mHourSize - 2;
1739 if ( size >= 4 ) 1739 if ( size >= 4 )
1740 configureAgenda( size ); 1740 configureAgenda( size );
1741 break; 1741 break;
1742 1742
1743 1743
1744 default: 1744 default:
1745 e->ignore(); 1745 e->ignore();
1746 } 1746 }
1747 if ( pro > 0 ) { 1747 if ( pro > 0 ) {
1748 mView->selectFilter( pro-1 ); 1748 mView->selectFilter( pro-1 );
1749 } 1749 }
1750 if ( showSelectedDates ) { 1750 if ( showSelectedDates ) {
1751 ;// setCaptionToDates(); 1751 ;// setCaptionToDates();
1752 } 1752 }
1753 1753
1754} 1754}
1755 1755
1756void MainWindow::fillFilterMenu() 1756void MainWindow::fillFilterMenu()
1757{ 1757{
1758 selectFilterMenu->clear(); 1758 selectFilterMenu->clear();
1759 bool disable = false; 1759 bool disable = false;
1760 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1760 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1761 selectFilterMenu->insertSeparator(); 1761 selectFilterMenu->insertSeparator();
1762 if ( mView->filterView()->filtersEnabled() ) { 1762 if ( mView->filterView()->filtersEnabled() ) {
1763 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1763 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1764 } 1764 }
1765 else { 1765 else {
1766 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1766 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1767 disable = true; 1767 disable = true;
1768 } 1768 }
1769 selectFilterMenu->insertSeparator(); 1769 selectFilterMenu->insertSeparator();
1770 QPtrList<CalFilter> fili = mView->filters(); 1770 QPtrList<CalFilter> fili = mView->filters();
1771 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1771 CalFilter *curfilter = mView->filterView()->selectedFilter();
1772 CalFilter *filter = fili.first(); 1772 CalFilter *filter = fili.first();
1773 int iii = 2; 1773 int iii = 2;
1774 while(filter) { 1774 while(filter) {
1775 selectFilterMenu->insertItem( filter->name(), iii ); 1775 selectFilterMenu->insertItem( filter->name(), iii );
1776 if ( filter == curfilter) 1776 if ( filter == curfilter)
1777 selectFilterMenu->setItemChecked( iii, true ); 1777 selectFilterMenu->setItemChecked( iii, true );
1778 if ( disable ) 1778 if ( disable )
1779 selectFilterMenu->setItemEnabled( iii, false ); 1779 selectFilterMenu->setItemEnabled( iii, false );
1780 filter = fili.next(); 1780 filter = fili.next();
1781 ++iii; 1781 ++iii;
1782 } 1782 }
1783} 1783}
1784void MainWindow::selectFilter( int fil ) 1784void MainWindow::selectFilter( int fil )
1785{ 1785{
1786 if ( fil == 0 ) { 1786 if ( fil == 0 ) {
1787 mView->editFilters( ); 1787 mView->editFilters( );
1788 } else if ( fil == 1 ){ 1788 } else if ( fil == 1 ){
1789 mView->toggleFilerEnabled( ); 1789 mView->toggleFilerEnabled( );
1790 } else { 1790 } else {
1791 mView->selectFilter( fil-2 ); 1791 mView->selectFilter( fil-2 );
1792 } 1792 }
1793} 1793}
1794void MainWindow::configureToolBar( int item ) 1794void MainWindow::configureToolBar( int item )
1795{ 1795{
1796 1796
1797 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1797 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1798 KOPrefs *p = KOPrefs::instance(); 1798 KOPrefs *p = KOPrefs::instance();
1799 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1799 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1800 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1800 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1801 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1801 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1802 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1802 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1803 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1803 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1804 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1804 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1805 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1805 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1806 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1806 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1807 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1807 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1808 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1808 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1809 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1809 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1810 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1810 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1811 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1811 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1812 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1812 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1813 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1813 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1814 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1814 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1815 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1815 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1816 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1816 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1817 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1817 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1818 // initActions(); 1818 // initActions();
1819} 1819}
1820 1820
1821void MainWindow::setCaptionToDates() 1821void MainWindow::setCaptionToDates()
1822{ 1822{
1823 QString selDates; 1823 QString selDates;
1824 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1824 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1825 if (mView->startDate() < mView->endDate() ) 1825 if (mView->startDate() < mView->endDate() )
1826 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1826 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1827 else { 1827 else {
1828 QString addString; 1828 QString addString;
1829 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1829 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1830 addString = i18n("Today"); 1830 addString = i18n("Today");
1831 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1831 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1832 addString = i18n("Tomorrow"); 1832 addString = i18n("Tomorrow");
1833 if ( !addString.isEmpty() ) 1833 if ( !addString.isEmpty() )
1834 selDates = addString+", "+selDates ; 1834 selDates = addString+", "+selDates ;
1835 } 1835 }
1836 setCaption( i18n("Dates: ") + selDates ); 1836 setCaption( i18n("Dates: ") + selDates );
1837 1837
1838} 1838}
1839void MainWindow::showConfigureAgenda( ) 1839void MainWindow::showConfigureAgenda( )
1840{ 1840{
1841 int iii; 1841 int iii;
1842 for ( iii = 1;iii<= 10 ;++iii ){ 1842 for ( iii = 1;iii<= 10 ;++iii ){
1843 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1843 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1844 } 1844 }
1845 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1845 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1846} 1846}
1847void MainWindow::configureAgenda( int item ) 1847void MainWindow::configureAgenda( int item )
1848{ 1848{
1849 if ( KOPrefs::instance()->mHourSize == item ) 1849 if ( KOPrefs::instance()->mHourSize == item )
1850 return; 1850 return;
1851 KOPrefs::instance()->mHourSize=item; 1851 KOPrefs::instance()->mHourSize=item;
1852 mView->viewManager()->agendaView()->updateConfig(); 1852 mView->viewManager()->agendaView()->updateConfig();
1853} 1853}
1854 1854
1855void MainWindow::saveCalendar() 1855void MainWindow::saveCalendar()
1856{ 1856{
1857 QString fn = KOPrefs::instance()->mLastSaveFile; 1857 QString fn = KOPrefs::instance()->mLastSaveFile;
1858 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1858 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1859 1859
1860 if ( fn == "" ) 1860 if ( fn == "" )
1861 return; 1861 return;
1862 QFileInfo info; 1862 QFileInfo info;
1863 info.setFile( fn ); 1863 info.setFile( fn );
1864 QString mes; 1864 QString mes;
1865 bool createbup = true; 1865 bool createbup = true;
1866 if ( info. exists() ) { 1866 if ( info. exists() ) {
1867 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1867 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1868 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1868 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1869 i18n("Overwrite!"), i18n("Cancel"), 0, 1869 i18n("Overwrite!"), i18n("Cancel"), 0,
1870 0, 1 ); 1870 0, 1 );
1871 if ( result != 0 ) { 1871 if ( result != 0 ) {
1872 createbup = false; 1872 createbup = false;
1873 } 1873 }
1874 } 1874 }
1875 if ( createbup ) { 1875 if ( createbup ) {
1876 mView->saveCalendar( fn ); 1876 mView->saveCalendar( fn );
1877 mes = i18n("KO/Pi:Saved %1").arg(fn); 1877 mes = i18n("KO/Pi:Saved %1").arg(fn);
1878 KOPrefs::instance()->mLastSaveFile = fn; 1878 KOPrefs::instance()->mLastSaveFile = fn;
1879 setCaption(mes); 1879 setCaption(mes);
1880 } 1880 }
1881} 1881}
1882void MainWindow::loadCalendar() 1882void MainWindow::loadCalendar()
1883{ 1883{
1884 1884
1885 QString fn = KOPrefs::instance()->mLastLoadFile; 1885 QString fn = KOPrefs::instance()->mLastLoadFile;
1886 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1886 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1887 1887
1888 if ( fn == "" ) 1888 if ( fn == "" )
1889 return; 1889 return;
1890 QFileInfo info; 1890 QFileInfo info;
1891 info.setFile( fn ); 1891 info.setFile( fn );
1892 QString mess; 1892 QString mess;
1893 bool loadbup = true; 1893 bool loadbup = true;
1894 if ( info. exists() ) { 1894 if ( info. exists() ) {
1895 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1895 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1896 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1896 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1897 mess, 1897 mess,
1898 i18n("Load!"), i18n("Cancel"), 0, 1898 i18n("Load!"), i18n("Cancel"), 0,
1899 0, 1 ); 1899 0, 1 );
1900 if ( result != 0 ) { 1900 if ( result != 0 ) {
1901 loadbup = false; 1901 loadbup = false;
1902 } 1902 }
1903 } else { 1903 } else {
1904 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1904 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1905 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1905 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1906 0, 1 ); 1906 0, 1 );
1907 1907
1908 return; 1908 return;
1909 } 1909 }
1910 if ( loadbup ) { 1910 if ( loadbup ) {
1911 mView->openCalendar( fn ); 1911 mView->openCalendar( fn );
1912 KOPrefs::instance()->mLastLoadFile = fn; 1912 KOPrefs::instance()->mLastLoadFile = fn;
1913 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1913 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1914 setCaption(mess); 1914 setCaption(mess);
1915 } 1915 }
1916 1916
1917} 1917}
1918void MainWindow::quickImportIcal() 1918void MainWindow::quickImportIcal()
1919{ 1919{
1920 importFile( KOPrefs::instance()->mLastImportFile, false ); 1920 importFile( KOPrefs::instance()->mLastImportFile, false );
1921} 1921}
1922void MainWindow::importFile( QString fn, bool quick ) 1922void MainWindow::importFile( QString fn, bool quick )
1923{ 1923{
1924 QFileInfo info; 1924 QFileInfo info;
1925 info.setFile( fn ); 1925 info.setFile( fn );
1926 QString mess; 1926 QString mess;
1927 bool loadbup = true; 1927 bool loadbup = true;
1928 if ( !info. exists() ) { 1928 if ( !info. exists() ) {
1929 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1929 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1930 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1930 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1931 mess ); 1931 mess );
1932 return; 1932 return;
1933 } 1933 }
1934 int result = 0; 1934 int result = 0;
1935 if ( !quick ) { 1935 if ( !quick ) {
1936 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 )); 1936 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 ));
1937 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1937 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1938 mess, 1938 mess,
1939 "Import", "Cancel", 0, 1939 "Import", "Cancel", 0,
1940 0, 1 ); 1940 0, 1 );
1941 } 1941 }
1942 if ( result == 0 ) { 1942 if ( result == 0 ) {
1943 if ( mView->openCalendar( fn, true )) { 1943 if ( mView->openCalendar( fn, true )) {
1944 KOPrefs::instance()->mLastImportFile = fn; 1944 KOPrefs::instance()->mLastImportFile = fn;
1945 setCaption(i18n("Imported file successfully")); 1945 setCaption(i18n("Imported file successfully"));
1946 } else { 1946 } else {
1947 setCaption(i18n("Error importing file")); 1947 setCaption(i18n("Error importing file"));
1948 } 1948 }
1949 } 1949 }
1950} 1950}
1951 1951
1952void MainWindow::importIcal() 1952void MainWindow::importIcal()
1953{ 1953{
1954 1954
1955 QString fn =KOPrefs::instance()->mLastImportFile; 1955 QString fn =KOPrefs::instance()->mLastImportFile;
1956 1956
1957 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1957 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1958 if ( fn == "" ) 1958 if ( fn == "" )
1959 return; 1959 return;
1960 importFile( fn, true ); 1960 importFile( fn, true );
1961 1961
1962} 1962}
1963 1963
1964void MainWindow::exportVCalendar() 1964void MainWindow::exportVCalendar()
1965{ 1965{
1966 QString fn = KOPrefs::instance()->mLastVcalFile; 1966 QString fn = KOPrefs::instance()->mLastVcalFile;
1967 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1967 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1968 if ( fn == "" ) 1968 if ( fn == "" )
1969 return; 1969 return;
1970 QFileInfo info; 1970 QFileInfo info;
1971 info.setFile( fn ); 1971 info.setFile( fn );
1972 QString mes; 1972 QString mes;
1973 bool createbup = true; 1973 bool createbup = true;
1974 if ( info. exists() ) { 1974 if ( info. exists() ) {
1975 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1975 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1976 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1976 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1977 i18n("Overwrite!"), i18n("Cancel"), 0, 1977 i18n("Overwrite!"), i18n("Cancel"), 0,
1978 0, 1 ); 1978 0, 1 );
1979 if ( result != 0 ) { 1979 if ( result != 0 ) {
1980 createbup = false; 1980 createbup = false;
1981 } 1981 }
1982 } 1982 }
1983 if ( createbup ) { 1983 if ( createbup ) {
1984 if ( mView->exportVCalendar( fn ) ) { 1984 if ( mView->exportVCalendar( fn ) ) {
1985 KOPrefs::instance()->mLastVcalFile = fn; 1985 KOPrefs::instance()->mLastVcalFile = fn;
1986 if ( fn.length() > 20 ) 1986 if ( fn.length() > 20 )
1987 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1987 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1988 else 1988 else
1989 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1989 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1990 setCaption(mes); 1990 setCaption(mes);
1991 } 1991 }
1992 } 1992 }
1993 1993
1994} 1994}
1995QString MainWindow::sentSyncFile()
1996{
1997#ifdef DESKTOP_VERSION
1998 return locateLocal( "tmp", "copysynccal.ics" );
1999#else
2000 return QString( "/tmp/copysynccal.ics" );
2001#endif
2002}
1995 2003
1996void MainWindow::syncFileRequest() 2004void MainWindow::syncFileRequest()
1997{ 2005{
1998 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2006 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1999 mSyncManager->slotSyncMenu( 999 ); 2007 mSyncManager->slotSyncMenu( 999 );
2000 } 2008 }
2001 save(); 2009
2010 setCaption(i18n("Saving Data to temp file ..." ));
2011 mView->saveCalendar( sentSyncFile() );
2012 setCaption(i18n("Data saved to temp file!" ));
2013
2002} 2014}
2003void MainWindow::getFile( bool success ) 2015void MainWindow::getFile( bool success )
2004{ 2016{
2005 if ( ! success ) { 2017 if ( ! success ) {
2006 setCaption( i18n("Error receiving file. Nothing changed!") ); 2018 setCaption( i18n("Error receiving file. Nothing changed!") );
2007 return; 2019 return;
2008 } 2020 }
2009 mView->openCalendar( defaultFileName() ); 2021 mView->openCalendar( sentSyncFile() );
2010 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2022 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2011 mSyncManager->slotSyncMenu( 999 ); 2023 mSyncManager->slotSyncMenu( 999 );
2012 } 2024 }
2013 setCaption( i18n("Pi-Sync successful!") ); 2025 setCaption( i18n("Pi-Sync successful!") );
2014} 2026}
2015 2027
2016void MainWindow::printSel( ) 2028void MainWindow::printSel( )
2017{ 2029{
2018 mView->viewManager()->agendaView()->agenda()->printSelection(); 2030 mView->viewManager()->agendaView()->agenda()->printSelection();
2019} 2031}
2020 2032
2021void MainWindow::printCal() 2033void MainWindow::printCal()
2022{ 2034{
2023 mView->print();//mCp->showDialog(); 2035 mView->print();//mCp->showDialog();
2024} 2036}
2025 2037
2026 2038
2027#include "libkdepim/kdatepicker.h" 2039#include "libkdepim/kdatepicker.h"
2028#include <kdatetbl.h> 2040#include <kdatetbl.h>
2029void MainWindow::weekAction() 2041void MainWindow::weekAction()
2030{ 2042{
2031 int month; 2043 int month;
2032 KPopupFrame* popup = new KPopupFrame(this); 2044 KPopupFrame* popup = new KPopupFrame(this);
2033 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2045 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2034 // ----- 2046 // -----
2035 picker->resize(picker->sizeHint()); 2047 picker->resize(picker->sizeHint());
2036 popup->setMainWidget(picker); 2048 popup->setMainWidget(picker);
2037 picker->setFocus(); 2049 picker->setFocus();
2038 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2050 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2039 int x = 0; 2051 int x = 0;
2040 int y = iconToolBar->height(); 2052 int y = iconToolBar->height();
2041 int dX = 0; 2053 int dX = 0;
2042 int dY = 0; 2054 int dY = 0;
2043 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2055 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2044 if ( iconToolBar->y() > height()/2 ) { 2056 if ( iconToolBar->y() > height()/2 ) {
2045 dY = picker->sizeHint().height()+8; 2057 dY = picker->sizeHint().height()+8;
2046 y = 0; 2058 y = 0;
2047 } 2059 }
2048 } else { 2060 } else {
2049 if ( iconToolBar->x() > width()/2 ) { // right side 2061 if ( iconToolBar->x() > width()/2 ) { // right side
2050 x=0; 2062 x=0;
2051 dX= picker->sizeHint().width()+8; 2063 dX= picker->sizeHint().width()+8;
2052 y = 0; 2064 y = 0;
2053 } else { 2065 } else {
2054 x= iconToolBar->width(); 2066 x= iconToolBar->width();
2055 y = 0; 2067 y = 0;
2056 } 2068 }
2057 } 2069 }
2058 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2070 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2059 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2071 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2060 { 2072 {
2061 month = picker->getResult(); 2073 month = picker->getResult();
2062 emit selectWeek ( month ); 2074 emit selectWeek ( month );
2063 //qDebug("weekSelected %d ", month); 2075 //qDebug("weekSelected %d ", month);
2064 } 2076 }
2065 delete popup; 2077 delete popup;
2066} 2078}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 5b9f903..5808700 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,158 +1,159 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h" 13#include "simplealarmclient.h"
14#include <ksyncmanager.h> 14#include <ksyncmanager.h>
15#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 16#include <qcopchannel_qws.h>
17#endif 17#endif
18class QAction; 18class QAction;
19class CalendarView; 19class CalendarView;
20class KSyncProfile; 20class KSyncProfile;
21#ifdef DESKTOP_VERSION 21#ifdef DESKTOP_VERSION
22 22
23#define QPEToolBar QToolBar 23#define QPEToolBar QToolBar
24#define QPEMenuBar QMenuBar 24#define QPEMenuBar QMenuBar
25#endif 25#endif
26class QPEToolBar; 26class QPEToolBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33class KOMenuBar : public QMenuBar 33class KOMenuBar : public QMenuBar
34{ 34{
35 public: 35 public:
36 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} 36 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
37 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} 37 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
38}; 38};
39 39
40using namespace KCal; 40using namespace KCal;
41 41
42class MainWindow : public QMainWindow 42class MainWindow : public QMainWindow
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 46 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
47 ~MainWindow(); 47 ~MainWindow();
48 bool beamReceiveEnabled(); 48 bool beamReceiveEnabled();
49 static QString defaultFileName(); 49 static QString defaultFileName();
50 static QString syncFileName(); 50 static QString syncFileName();
51 static QString resourcePath(); 51 static QString resourcePath();
52 public slots: 52 public slots:
53 void updateWeekNum(const KCal::DateList &); 53 void updateWeekNum(const KCal::DateList &);
54 void updateWeek(QDate); 54 void updateWeek(QDate);
55 virtual void showMaximized (); 55 virtual void showMaximized ();
56 void configureAgenda( int ); 56 void configureAgenda( int );
57 void recieve( const QCString& msg, const QByteArray& data ); 57 void recieve( const QCString& msg, const QByteArray& data );
58 protected slots: 58 protected slots:
59 void setCaptionToDates(); 59 void setCaptionToDates();
60 void weekAction(); 60 void weekAction();
61 void about(); 61 void about();
62 void licence(); 62 void licence();
63 void faq(); 63 void faq();
64 void usertrans(); 64 void usertrans();
65 void features(); 65 void features();
66 void synchowto(); 66 void synchowto();
67 void kdesynchowto(); 67 void kdesynchowto();
68 void multisynchowto(); 68 void multisynchowto();
69 void whatsNew(); 69 void whatsNew();
70 void keyBindings(); 70 void keyBindings();
71 void aboutAutoSaving();; 71 void aboutAutoSaving();;
72 void aboutKnownBugs(); 72 void aboutKnownBugs();
73 73
74 void processIncidenceSelection( Incidence * ); 74 void processIncidenceSelection( Incidence * );
75 75
76 void importQtopia(); 76 void importQtopia();
77 void importBday(); 77 void importBday();
78 void importOL(); 78 void importOL();
79 void importIcal(); 79 void importIcal();
80 void importFile( QString, bool ); 80 void importFile( QString, bool );
81 void quickImportIcal(); 81 void quickImportIcal();
82 82
83 void slotModifiedChanged( bool ); 83 void slotModifiedChanged( bool );
84 84
85 void save(); 85 void save();
86 void saveStopTimer(); 86 void saveStopTimer();
87 void configureToolBar( int ); 87 void configureToolBar( int );
88 void printSel(); 88 void printSel();
89 void printCal(); 89 void printCal();
90 void saveCalendar(); 90 void saveCalendar();
91 void loadCalendar(); 91 void loadCalendar();
92 void exportVCalendar(); 92 void exportVCalendar();
93 void fillFilterMenu(); 93 void fillFilterMenu();
94 void selectFilter( int ); 94 void selectFilter( int );
95 void exportToPhone( int ); 95 void exportToPhone( int );
96 void toggleBeamReceive(); 96 void toggleBeamReceive();
97 void disableBR(bool); 97 void disableBR(bool);
98 signals: 98 signals:
99 void selectWeek ( int ); 99 void selectWeek ( int );
100 private slots: 100 private slots:
101 void showConfigureAgenda(); 101 void showConfigureAgenda();
102 void getFile( bool ); 102 void getFile( bool );
103 void syncFileRequest(); 103 void syncFileRequest();
104 104
105 protected: 105 protected:
106 QString sentSyncFile();
106 void displayText( QString, QString); 107 void displayText( QString, QString);
107 void enableIncidenceActions( bool ); 108 void enableIncidenceActions( bool );
108 109
109 private: 110 private:
110 bool mBRdisabled; 111 bool mBRdisabled;
111#ifndef DESKTOP_VERSION 112#ifndef DESKTOP_VERSION
112 QCopChannel* infrared; 113 QCopChannel* infrared;
113#endif 114#endif
114 QAction* brAction; 115 QAction* brAction;
115 KSyncManager* mSyncManager; 116 KSyncManager* mSyncManager;
116 bool mClosed; 117 bool mClosed;
117 void saveOnClose(); 118 void saveOnClose();
118 bool mFlagKeyPressed; 119 bool mFlagKeyPressed;
119 bool mBlockAtStartup; 120 bool mBlockAtStartup;
120 QPEToolBar *iconToolBar; 121 QPEToolBar *iconToolBar;
121 void initActions(); 122 void initActions();
122 void setDefaultPreferences(); 123 void setDefaultPreferences();
123 void keyPressEvent ( QKeyEvent * ) ; 124 void keyPressEvent ( QKeyEvent * ) ;
124 void keyReleaseEvent ( QKeyEvent * ) ; 125 void keyReleaseEvent ( QKeyEvent * ) ;
125 QPopupMenu *configureToolBarMenu; 126 QPopupMenu *configureToolBarMenu;
126 QPopupMenu *selectFilterMenu; 127 QPopupMenu *selectFilterMenu;
127 QPopupMenu *configureAgendaMenu, *syncMenu; 128 QPopupMenu *configureAgendaMenu, *syncMenu;
128 CalendarLocal *mCalendar; 129 CalendarLocal *mCalendar;
129 CalendarView *mView; 130 CalendarView *mView;
130 QAction *mNewSubTodoAction; 131 QAction *mNewSubTodoAction;
131 QAction *mWeekAction; 132 QAction *mWeekAction;
132 QFont mWeekFont; 133 QFont mWeekFont;
133 QPixmap mWeekPixmap; 134 QPixmap mWeekPixmap;
134 QColor mWeekBgColor; 135 QColor mWeekBgColor;
135 136
136 QAction *mShowAction; 137 QAction *mShowAction;
137 QAction *mEditAction; 138 QAction *mEditAction;
138 QAction *mDeleteAction; 139 QAction *mDeleteAction;
139 QAction *mCloneAction; 140 QAction *mCloneAction;
140 QAction *mMoveAction; 141 QAction *mMoveAction;
141 QAction *mBeamAction; 142 QAction *mBeamAction;
142 QAction *mCancelAction; 143 QAction *mCancelAction;
143 144
144 QAction *mToggleNav; 145 QAction *mToggleNav;
145 QAction *mToggleFilter; 146 QAction *mToggleFilter;
146 QAction *mToggleAllday; 147 QAction *mToggleAllday;
147 148
148 149
149 void closeEvent( QCloseEvent* ce ); 150 void closeEvent( QCloseEvent* ce );
150 SimpleAlarmClient mAlarmClient; 151 SimpleAlarmClient mAlarmClient;
151 QTimer mSaveTimer; 152 QTimer mSaveTimer;
152 //bool mBlockSaveFlag; 153 //bool mBlockSaveFlag;
153 bool mCalendarModifiedFlag; 154 bool mCalendarModifiedFlag;
154 QPixmap loadPixmap( QString ); 155 QPixmap loadPixmap( QString );
155}; 156};
156 157
157 158
158#endif 159#endif
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 9177f63..c8d0e0d 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1,1500 +1,1503 @@
1/* 1/*
2 This file is part of KDE-Pim/Pi. 2 This file is part of KDE-Pim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21// $Id$ 21// $Id$
22 22
23#include "ksyncmanager.h" 23#include "ksyncmanager.h"
24 24
25#include <stdlib.h> 25#include <stdlib.h>
26 26
27#ifndef _WIN32_ 27#ifndef _WIN32_
28#include <unistd.h> 28#include <unistd.h>
29#endif 29#endif
30 30
31 31
32#include "ksyncprofile.h" 32#include "ksyncprofile.h"
33#include "ksyncprefsdialog.h" 33#include "ksyncprefsdialog.h"
34#include "kpimprefs.h" 34#include "kpimprefs.h"
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qprogressbar.h> 38#include <qprogressbar.h>
39#include <qpopupmenu.h> 39#include <qpopupmenu.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qradiobutton.h> 41#include <qradiobutton.h>
42#include <qbuttongroup.h> 42#include <qbuttongroup.h>
43#include <qtimer.h> 43#include <qtimer.h>
44#include <qmessagebox.h> 44#include <qmessagebox.h>
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qtextcodec.h> 49#include <qtextcodec.h>
50#include <qlabel.h> 50#include <qlabel.h>
51#include <qcheckbox.h> 51#include <qcheckbox.h>
52 52
53#include <klocale.h> 53#include <klocale.h>
54#include <kglobal.h> 54#include <kglobal.h>
55#include <kconfig.h> 55#include <kconfig.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57 57
58QDateTime KSyncManager::mRequestedSyncEvent; 58QDateTime KSyncManager::mRequestedSyncEvent;
59 59
60 60
61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
62 : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) 62 : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu)
63{ 63{
64 mServerSocket = 0; 64 mServerSocket = 0;
65 bar = new QProgressBar ( 1, 0 ); 65 bar = new QProgressBar ( 1, 0 );
66 bar->setCaption (""); 66 bar->setCaption ("");
67 mWriteBackInPast = 2; 67 mWriteBackInPast = 2;
68 int w = 300; 68 int w = 300;
69 if ( QApplication::desktop()->width() < 320 ) 69 if ( QApplication::desktop()->width() < 320 )
70 w = 220; 70 w = 220;
71 int h = bar->sizeHint().height() ; 71 int h = bar->sizeHint().height() ;
72 int dw = QApplication::desktop()->width(); 72 int dw = QApplication::desktop()->width();
73 int dh = QApplication::desktop()->height(); 73 int dh = QApplication::desktop()->height();
74 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 74 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
75 if ( mPrefs->mPassiveSyncAutoStart )
76 enableQuick( false );
77 75
78} 76}
79 77
80KSyncManager::~KSyncManager() 78KSyncManager::~KSyncManager()
81{ 79{
82 delete bar; 80 delete bar;
83} 81}
84 82
83void KSyncManager::setDefaultFileName( QString s)
84{
85 mDefFileName = s ;
86 if ( mPrefs->mPassiveSyncAutoStart )
87 enableQuick( false );
88}
85 89
86void KSyncManager::fillSyncMenu() 90void KSyncManager::fillSyncMenu()
87{ 91{
88 if ( mSyncMenu->count() ) 92 if ( mSyncMenu->count() )
89 mSyncMenu->clear(); 93 mSyncMenu->clear();
90 94
91 mSyncMenu->insertItem( i18n("Configure..."), 0 ); 95 mSyncMenu->insertItem( i18n("Configure..."), 0 );
92 mSyncMenu->insertSeparator(); 96 mSyncMenu->insertSeparator();
93 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); 97 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
94 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); 98 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
95 clearMenu->insertItem( i18n("For all profiles"), 1 ); 99 clearMenu->insertItem( i18n("For all profiles"), 1 );
96 clearMenu->insertSeparator(); 100 clearMenu->insertSeparator();
97 connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); 101 connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) );
98 mSyncMenu->insertSeparator(); 102 mSyncMenu->insertSeparator();
99 if ( mServerSocket == 0 ) { 103 if ( mServerSocket == 0 ) {
100 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); 104 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
101 } else { 105 } else {
102 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 106 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
103 } 107 }
104 mSyncMenu->insertSeparator(); 108 mSyncMenu->insertSeparator();
105 mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); 109 mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
106 mSyncMenu->insertSeparator(); 110 mSyncMenu->insertSeparator();
107 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 111 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
108 config.setGroup("General"); 112 config.setGroup("General");
109 QStringList prof = config.readListEntry("SyncProfileNames"); 113 QStringList prof = config.readListEntry("SyncProfileNames");
110 mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 114 mLocalMachineName = config.readEntry("LocalMachineName","undefined");
111 if ( prof.count() < 2 ) { 115 if ( prof.count() < 2 ) {
112 prof.clear(); 116 prof.clear();
113 QString externalName; 117 QString externalName;
114#ifdef DESKTOP_VERSION 118#ifdef DESKTOP_VERSION
115#ifdef _WIN32_ 119#ifdef _WIN32_
116 externalName = "OutLook(not_implemented)"; 120 externalName = "OutLook(not_implemented)";
117#else 121#else
118 externalName = "KDE_Desktop"; 122 externalName = "KDE_Desktop";
119#endif 123#endif
120#else 124#else
121 externalName = "Sharp_DTM"; 125 externalName = "Sharp_DTM";
122#endif 126#endif
123 prof << externalName; 127 prof << externalName;
124 prof << i18n("Local_file"); 128 prof << i18n("Local_file");
125 prof << i18n("Last_file"); 129 prof << i18n("Last_file");
126 KSyncProfile* temp = new KSyncProfile (); 130 KSyncProfile* temp = new KSyncProfile ();
127 temp->setName( prof[0] ); 131 temp->setName( prof[0] );
128 temp->writeConfig(&config); 132 temp->writeConfig(&config);
129 temp->setName( prof[1] ); 133 temp->setName( prof[1] );
130 temp->writeConfig(&config); 134 temp->writeConfig(&config);
131 temp->setName( prof[2] ); 135 temp->setName( prof[2] );
132 temp->writeConfig(&config); 136 temp->writeConfig(&config);
133 config.setGroup("General"); 137 config.setGroup("General");
134 config.writeEntry("SyncProfileNames",prof); 138 config.writeEntry("SyncProfileNames",prof);
135 config.writeEntry("ExternSyncProfiles",externalName); 139 config.writeEntry("ExternSyncProfiles",externalName);
136 config.sync(); 140 config.sync();
137 delete temp; 141 delete temp;
138 } 142 }
139 mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 143 mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
140 mSyncProfileNames = prof; 144 mSyncProfileNames = prof;
141 unsigned int i; 145 unsigned int i;
142 for ( i = 0; i < prof.count(); ++i ) { 146 for ( i = 0; i < prof.count(); ++i ) {
143 mSyncMenu->insertItem( prof[i], 1000+i ); 147 mSyncMenu->insertItem( prof[i], 1000+i );
144 clearMenu->insertItem( prof[i], 1000+i ); 148 clearMenu->insertItem( prof[i], 1000+i );
145 if ( i == 2 ) 149 if ( i == 2 )
146 mSyncMenu->insertSeparator(); 150 mSyncMenu->insertSeparator();
147 } 151 }
148 QDir app_dir; 152 QDir app_dir;
149 //US do not display SharpDTM if app is pwmpi, or no sharpfiles available 153 //US do not display SharpDTM if app is pwmpi, or no sharpfiles available
150 if ( mTargetApp == PWMPI) { 154 if ( mTargetApp == PWMPI) {
151 mSyncMenu->removeItem( 1000 ); 155 mSyncMenu->removeItem( 1000 );
152 clearMenu->removeItem( 1000 ); 156 clearMenu->removeItem( 1000 );
153 } 157 }
154#ifndef DESKTOP_VERSION 158#ifndef DESKTOP_VERSION
155 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 159 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
156 mSyncMenu->removeItem( 1000 ); 160 mSyncMenu->removeItem( 1000 );
157 clearMenu->removeItem( 1000 ); 161 clearMenu->removeItem( 1000 );
158 } 162 }
159#endif 163#endif
160 mSyncMenu->removeItem( 1002 ); 164 mSyncMenu->removeItem( 1002 );
161 clearMenu->removeItem( 1002 ); 165 clearMenu->removeItem( 1002 );
162} 166}
163void KSyncManager::slotClearMenu( int action ) 167void KSyncManager::slotClearMenu( int action )
164{ 168{
165 QString syncDevice; 169 QString syncDevice;
166 if ( action > 999 ) { 170 if ( action > 999 ) {
167 syncDevice = mSyncProfileNames[action - 1000] ; 171 syncDevice = mSyncProfileNames[action - 1000] ;
168 } 172 }
169 173
170 174
171 175
172 int result = 0; 176 int result = 0;
173 QString sd; 177 QString sd;
174 if ( syncDevice.isEmpty() ) 178 if ( syncDevice.isEmpty() )
175 sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); 179 sd = i18n("Do you want to\nclear all sync info\nof all profiles?");
176 else 180 else
177 sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); 181 sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice );
178 182
179 result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, 183 result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0,
180 0, 1 ); 184 0, 1 );
181 if ( result ) 185 if ( result )
182 return; 186 return;
183 mImplementation->removeSyncInfo( syncDevice ); 187 mImplementation->removeSyncInfo( syncDevice );
184} 188}
185void KSyncManager::slotSyncMenu( int action ) 189void KSyncManager::slotSyncMenu( int action )
186{ 190{
187 qDebug("KSM::syncaction %d ", action); 191 qDebug("KSM::syncaction %d ", action);
188 if ( action == 5000 ) 192 if ( action == 5000 )
189 return; 193 return;
190 mSyncWithDesktop = false; 194 mSyncWithDesktop = false;
191 if ( action == 0 ) { 195 if ( action == 0 ) {
192 196
193 // seems to be a Qt2 event handling bug 197 // seems to be a Qt2 event handling bug
194 // syncmenu.clear causes a segfault at first time 198 // syncmenu.clear causes a segfault at first time
195 // when we call it after the main event loop, it is ok 199 // when we call it after the main event loop, it is ok
196 // same behaviour when calling OM/Pi via QCOP for the first time 200 // same behaviour when calling OM/Pi via QCOP for the first time
197 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 201 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
198 //confSync(); 202 //confSync();
199 203
200 return; 204 return;
201 } 205 }
202 if ( action == 1 ) { 206 if ( action == 1 ) {
203 multiSync( true ); 207 multiSync( true );
204 return; 208 return;
205 } 209 }
206 if ( action == 2 ) { 210 if ( action == 2 ) {
207 enableQuick(); 211 enableQuick();
208 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 212 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
209 return; 213 return;
210 } 214 }
211 if ( action == 3 ) { 215 if ( action == 3 ) {
212 delete mServerSocket; 216 delete mServerSocket;
213 mServerSocket = 0; 217 mServerSocket = 0;
214 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 218 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
215 return; 219 return;
216 } 220 }
217 221
218 if (blockSave()) 222 if (blockSave())
219 return; 223 return;
220 224
221 setBlockSave(true); 225 setBlockSave(true);
222 bool silent = false; 226 bool silent = false;
223 if ( action == 999 ) { 227 if ( action == 999 ) {
224 //special mode for silent syncing 228 //special mode for silent syncing
225 action = 1000; 229 action = 1000;
226 silent = true; 230 silent = true;
227 } 231 }
228 232
229 mCurrentSyncProfile = action - 1000 ; 233 mCurrentSyncProfile = action - 1000 ;
230 mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; 234 mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ;
231 mCurrentSyncName = mLocalMachineName ; 235 mCurrentSyncName = mLocalMachineName ;
232 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 236 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
233 KSyncProfile* temp = new KSyncProfile (); 237 KSyncProfile* temp = new KSyncProfile ();
234 temp->setName(mSyncProfileNames[mCurrentSyncProfile]); 238 temp->setName(mSyncProfileNames[mCurrentSyncProfile]);
235 temp->readConfig(&config); 239 temp->readConfig(&config);
236 if (silent) { 240 if (silent) {
237 mAskForPreferences = false; 241 mAskForPreferences = false;
238 mShowSyncSummary = false; 242 mShowSyncSummary = false;
239 mWriteBackFile = true; 243 mWriteBackFile = true;
240 mSyncAlgoPrefs = 2;// take newest 244 mSyncAlgoPrefs = 2;// take newest
241 } 245 }
242 else { 246 else {
243 mAskForPreferences = temp->getAskForPreferences(); 247 mAskForPreferences = temp->getAskForPreferences();
244 mShowSyncSummary = temp->getShowSummaryAfterSync(); 248 mShowSyncSummary = temp->getShowSummaryAfterSync();
245 mWriteBackFile = temp->getWriteBackFile(); 249 mWriteBackFile = temp->getWriteBackFile();
246 mSyncAlgoPrefs = temp->getSyncPrefs(); 250 mSyncAlgoPrefs = temp->getSyncPrefs();
247 } 251 }
248 mWriteBackExistingOnly = temp->getWriteBackExisting(); 252 mWriteBackExistingOnly = temp->getWriteBackExisting();
249 mIsKapiFile = temp->getIsKapiFile(); 253 mIsKapiFile = temp->getIsKapiFile();
250 mWriteBackInFuture = 0; 254 mWriteBackInFuture = 0;
251 if ( temp->getWriteBackFuture() ) { 255 if ( temp->getWriteBackFuture() ) {
252 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 256 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
253 mWriteBackInPast = temp->getWriteBackPastWeeks( ); 257 mWriteBackInPast = temp->getWriteBackPastWeeks( );
254 } 258 }
255 mFilterInCal = temp->getFilterInCal(); 259 mFilterInCal = temp->getFilterInCal();
256 mFilterOutCal = temp->getFilterOutCal(); 260 mFilterOutCal = temp->getFilterOutCal();
257 mFilterInAB = temp->getFilterInAB(); 261 mFilterInAB = temp->getFilterInAB();
258 mFilterOutAB = temp->getFilterOutAB(); 262 mFilterOutAB = temp->getFilterOutAB();
259 263
260 if ( action == 1000 ) { 264 if ( action == 1000 ) {
261 mIsKapiFile = false; 265 mIsKapiFile = false;
262#ifdef DESKTOP_VERSION 266#ifdef DESKTOP_VERSION
263 syncKDE(); 267 syncKDE();
264#else 268#else
265 syncSharp(); 269 syncSharp();
266#endif 270#endif
267 271
268 } else if ( action == 1001 ) { 272 } else if ( action == 1001 ) {
269 syncLocalFile(); 273 syncLocalFile();
270 274
271 } else if ( action == 1002 ) { 275 } else if ( action == 1002 ) {
272 mWriteBackFile = false; 276 mWriteBackFile = false;
273 mAskForPreferences = false; 277 mAskForPreferences = false;
274 mShowSyncSummary = false; 278 mShowSyncSummary = false;
275 mSyncAlgoPrefs = 3; 279 mSyncAlgoPrefs = 3;
276 quickSyncLocalFile(); 280 quickSyncLocalFile();
277 281
278 } else if ( action >= 1003 ) { 282 } else if ( action >= 1003 ) {
279 if ( temp->getIsLocalFileSync() ) { 283 if ( temp->getIsLocalFileSync() ) {
280 switch(mTargetApp) 284 switch(mTargetApp)
281 { 285 {
282 case (KAPI): 286 case (KAPI):
283 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 287 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
284 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 288 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
285 break; 289 break;
286 case (KOPI): 290 case (KOPI):
287 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 291 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
288 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 292 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
289 break; 293 break;
290 case (PWMPI): 294 case (PWMPI):
291 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 295 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
292 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 296 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
293 break; 297 break;
294 default: 298 default:
295 qDebug("KSM::slotSyncMenu: invalid apptype selected"); 299 qDebug("KSM::slotSyncMenu: invalid apptype selected");
296 break; 300 break;
297 301
298 } 302 }
299 } else { 303 } else {
300 if ( temp->getIsPhoneSync() ) { 304 if ( temp->getIsPhoneSync() ) {
301 mPhoneDevice = temp->getPhoneDevice( ) ; 305 mPhoneDevice = temp->getPhoneDevice( ) ;
302 mPhoneConnection = temp->getPhoneConnection( ); 306 mPhoneConnection = temp->getPhoneConnection( );
303 mPhoneModel = temp->getPhoneModel( ); 307 mPhoneModel = temp->getPhoneModel( );
304 syncPhone(); 308 syncPhone();
305 } else if ( temp->getIsPiSync() ) { 309 } else if ( temp->getIsPiSync() ) {
306 if ( mTargetApp == KAPI ) { 310 if ( mTargetApp == KAPI ) {
307 mPassWordPiSync = temp->getRemotePwAB(); 311 mPassWordPiSync = temp->getRemotePwAB();
308 mActiveSyncPort = temp->getRemotePortAB(); 312 mActiveSyncPort = temp->getRemotePortAB();
309 mActiveSyncIP = temp->getRemoteIPAB(); 313 mActiveSyncIP = temp->getRemoteIPAB();
310 } else if ( mTargetApp == KOPI ) { 314 } else if ( mTargetApp == KOPI ) {
311 mPassWordPiSync = temp->getRemotePw(); 315 mPassWordPiSync = temp->getRemotePw();
312 mActiveSyncPort = temp->getRemotePort(); 316 mActiveSyncPort = temp->getRemotePort();
313 mActiveSyncIP = temp->getRemoteIP(); 317 mActiveSyncIP = temp->getRemoteIP();
314 } else { 318 } else {
315 mPassWordPiSync = temp->getRemotePwPWM(); 319 mPassWordPiSync = temp->getRemotePwPWM();
316 mActiveSyncPort = temp->getRemotePortPWM(); 320 mActiveSyncPort = temp->getRemotePortPWM();
317 mActiveSyncIP = temp->getRemoteIPPWM(); 321 mActiveSyncIP = temp->getRemoteIPPWM();
318 } 322 }
319 syncPi(); 323 syncPi();
320 while ( !mPisyncFinished ) { 324 while ( !mPisyncFinished ) {
321 //qDebug("waiting "); 325 //qDebug("waiting ");
322 qApp->processEvents(); 326 qApp->processEvents();
323 } 327 }
324 } else 328 } else
325 syncRemote( temp ); 329 syncRemote( temp );
326 330
327 } 331 }
328 } 332 }
329 delete temp; 333 delete temp;
330 setBlockSave(false); 334 setBlockSave(false);
331} 335}
332 336
333void KSyncManager::enableQuick( bool ask ) 337void KSyncManager::enableQuick( bool ask )
334{ 338{
335 bool autoStart; 339 bool autoStart;
336 bool changed = false; 340 bool changed = false;
337 if ( ask ) { 341 if ( ask ) {
338 QDialog dia ( 0, "input-dialog", true ); 342 QDialog dia ( 0, "input-dialog", true );
339 QLineEdit lab ( &dia ); 343 QLineEdit lab ( &dia );
340 QVBoxLayout lay( &dia ); 344 QVBoxLayout lay( &dia );
341 lab.setText( mPrefs->mPassiveSyncPort ); 345 lab.setText( mPrefs->mPassiveSyncPort );
342 lay.setMargin(7); 346 lay.setMargin(7);
343 lay.setSpacing(7); 347 lay.setSpacing(7);
344 int po = 9197+mTargetApp; 348 int po = 9197+mTargetApp;
345 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); 349 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
346 lay.addWidget( &label); 350 lay.addWidget( &label);
347 lay.addWidget( &lab); 351 lay.addWidget( &lab);
348 352
349 QLineEdit lepw ( &dia ); 353 QLineEdit lepw ( &dia );
350 lepw.setText( mPrefs->mPassiveSyncPw ); 354 lepw.setText( mPrefs->mPassiveSyncPw );
351 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); 355 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
352 lay.addWidget( &label2); 356 lay.addWidget( &label2);
353 lay.addWidget( &lepw); 357 lay.addWidget( &lepw);
354 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); 358 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
355 lay.addWidget( &autostart); 359 lay.addWidget( &autostart);
356 autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); 360 autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
357#ifdef DESKTOP_VERSION 361#ifdef DESKTOP_VERSION
358#ifdef _WIN32_ 362#ifdef _WIN32_
359 QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); 363 QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia );
360 syncdesktop.hide();// not implemented! 364 syncdesktop.hide();// not implemented!
361#else 365#else
362 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); 366 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
363#endif 367#endif
364 lay.addWidget( &syncdesktop); 368 lay.addWidget( &syncdesktop);
365#else 369#else
366 mPrefs->mPassiveSyncWithDesktop = false; 370 mPrefs->mPassiveSyncWithDesktop = false;
367 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); 371 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
368 syncdesktop.hide(); 372 syncdesktop.hide();
369#endif 373#endif
370 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); 374 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop );
371 375
372 QPushButton pb ( "OK", &dia); 376 QPushButton pb ( "OK", &dia);
373 lay.addWidget( &pb ); 377 lay.addWidget( &pb );
374 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 378 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
375 dia.resize( 230,120 ); 379 dia.resize( 230,120 );
376 dia.setCaption( i18n("Enter port for Pi-Sync") ); 380 dia.setCaption( i18n("Enter port for Pi-Sync") );
377 dia.show(); 381 dia.show();
378#ifndef DESKTOP_VERSION 382#ifndef DESKTOP_VERSION
379 int dw = QApplication::desktop()->width(); 383 int dw = QApplication::desktop()->width();
380 int dh = QApplication::desktop()->height(); 384 int dh = QApplication::desktop()->height();
381 dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); 385 dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 );
382#endif 386#endif
383 if ( ! dia.exec() ) 387 if ( ! dia.exec() )
384 return; 388 return;
385 dia.hide(); 389 dia.hide();
386 qApp->processEvents(); 390 qApp->processEvents();
387 if ( mPrefs->mPassiveSyncPw != lepw.text() ) { 391 if ( mPrefs->mPassiveSyncPw != lepw.text() ) {
388 changed = true; 392 changed = true;
389 mPrefs->mPassiveSyncPw = lepw.text(); 393 mPrefs->mPassiveSyncPw = lepw.text();
390 } 394 }
391 if ( mPrefs->mPassiveSyncPort != lab.text() ) { 395 if ( mPrefs->mPassiveSyncPort != lab.text() ) {
392 mPrefs->mPassiveSyncPort = lab.text(); 396 mPrefs->mPassiveSyncPort = lab.text();
393 changed = true; 397 changed = true;
394 } 398 }
395 autoStart = autostart.isChecked(); 399 autoStart = autostart.isChecked();
396 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { 400 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) {
397 changed = true; 401 changed = true;
398 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); 402 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
399 } 403 }
400 } 404 }
401 else 405 else
402 autoStart = mPrefs->mPassiveSyncAutoStart; 406 autoStart = mPrefs->mPassiveSyncAutoStart;
403 if ( autoStart != mPrefs->mPassiveSyncAutoStart ) 407 if ( autoStart != mPrefs->mPassiveSyncAutoStart )
404 changed = true; 408 changed = true;
405 bool ok; 409 bool ok;
406 mPrefs->mPassiveSyncAutoStart = false; 410 mPrefs->mPassiveSyncAutoStart = false;
407 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); 411 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok);
408 if ( ! ok ) { 412 if ( ! ok ) {
409 KMessageBox::information( 0, i18n("No valid port")); 413 KMessageBox::information( 0, i18n("No valid port"));
410 return; 414 return;
411 } 415 }
412 //qDebug("port %d ", port); 416 //qDebug("port %d ", port);
413 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); 417 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
414 mServerSocket->setFileName( defaultFileName() );//bbb 418 mServerSocket->setFileName( defaultFileName() );//bbb
415 //qDebug("connected ");
416 if ( !mServerSocket->ok() ) { 419 if ( !mServerSocket->ok() ) {
417 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); 420 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!"));
418 delete mServerSocket; 421 delete mServerSocket;
419 mServerSocket = 0; 422 mServerSocket = 0;
420 return; 423 return;
421 } 424 }
422 mPrefs->mPassiveSyncAutoStart = autoStart; 425 mPrefs->mPassiveSyncAutoStart = autoStart;
423 if ( changed ) { 426 if ( changed ) {
424 mPrefs->writeConfig(); 427 mPrefs->writeConfig();
425 } 428 }
426 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 429 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
427 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); 430 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
428} 431}
429 432
430void KSyncManager::syncLocalFile() 433void KSyncManager::syncLocalFile()
431{ 434{
432 435
433 QString fn =mPrefs->mLastSyncedLocalFile; 436 QString fn =mPrefs->mLastSyncedLocalFile;
434 QString ext; 437 QString ext;
435 438
436 switch(mTargetApp) 439 switch(mTargetApp)
437 { 440 {
438 case (KAPI): 441 case (KAPI):
439 ext = "(*.vcf)"; 442 ext = "(*.vcf)";
440 break; 443 break;
441 case (KOPI): 444 case (KOPI):
442 ext = "(*.ics/*.vcs)"; 445 ext = "(*.ics/*.vcs)";
443 break; 446 break;
444 case (PWMPI): 447 case (PWMPI):
445 ext = "(*.pwm)"; 448 ext = "(*.pwm)";
446 break; 449 break;
447 default: 450 default:
448 qDebug("KSM::syncLocalFile: invalid apptype selected"); 451 qDebug("KSM::syncLocalFile: invalid apptype selected");
449 break; 452 break;
450 453
451 } 454 }
452 455
453 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); 456 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent );
454 if ( fn == "" ) 457 if ( fn == "" )
455 return; 458 return;
456 if ( syncWithFile( fn, false ) ) { 459 if ( syncWithFile( fn, false ) ) {
457 qDebug("KSM::syncLocalFile() successful "); 460 qDebug("KSM::syncLocalFile() successful ");
458 } 461 }
459 462
460} 463}
461 464
462bool KSyncManager::syncWithFile( QString fn , bool quick ) 465bool KSyncManager::syncWithFile( QString fn , bool quick )
463{ 466{
464 bool ret = false; 467 bool ret = false;
465 QFileInfo info; 468 QFileInfo info;
466 info.setFile( fn ); 469 info.setFile( fn );
467 QString mess; 470 QString mess;
468 if ( !info. exists() ) { 471 if ( !info. exists() ) {
469 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 472 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
470 QMessageBox::warning( mParent, i18n("Warning!"), 473 QMessageBox::warning( mParent, i18n("Warning!"),
471 mess ); 474 mess );
472 return ret; 475 return ret;
473 } 476 }
474 int result = 0; 477 int result = 0;
475 if ( !quick ) { 478 if ( !quick ) {
476 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 479 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
477 result = QMessageBox::warning( mParent, i18n("Warning!"), 480 result = QMessageBox::warning( mParent, i18n("Warning!"),
478 mess, 481 mess,
479 i18n("Sync"), i18n("Cancel"), 0, 482 i18n("Sync"), i18n("Cancel"), 0,
480 0, 1 ); 483 0, 1 );
481 if ( result ) 484 if ( result )
482 return false; 485 return false;
483 } 486 }
484 if ( mAskForPreferences ) 487 if ( mAskForPreferences )
485 if ( !edit_sync_options()) { 488 if ( !edit_sync_options()) {
486 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 489 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
487 return false; 490 return false;
488 } 491 }
489 if ( result == 0 ) { 492 if ( result == 0 ) {
490 //qDebug("Now sycing ... "); 493 //qDebug("Now sycing ... ");
491 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 494 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
492 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); 495 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
493 else 496 else
494 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 497 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
495 if ( ! quick ) 498 if ( ! quick )
496 mPrefs->mLastSyncedLocalFile = fn; 499 mPrefs->mLastSyncedLocalFile = fn;
497 } 500 }
498 return ret; 501 return ret;
499} 502}
500 503
501void KSyncManager::quickSyncLocalFile() 504void KSyncManager::quickSyncLocalFile()
502{ 505{
503 506
504 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { 507 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
505 qDebug("KSM::quick syncLocalFile() successful "); 508 qDebug("KSM::quick syncLocalFile() successful ");
506 509
507 } 510 }
508} 511}
509 512
510void KSyncManager::multiSync( bool askforPrefs ) 513void KSyncManager::multiSync( bool askforPrefs )
511{ 514{
512 if (blockSave()) 515 if (blockSave())
513 return; 516 return;
514 setBlockSave(true); 517 setBlockSave(true);
515 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 518 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
516 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), 519 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
517 question, 520 question,
518 i18n("Yes"), i18n("No"), 521 i18n("Yes"), i18n("No"),
519 0, 0 ) != 0 ) { 522 0, 0 ) != 0 ) {
520 setBlockSave(false); 523 setBlockSave(false);
521 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); 524 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
522 return; 525 return;
523 } 526 }
524 mCurrentSyncDevice = i18n("Multiple profiles") ; 527 mCurrentSyncDevice = i18n("Multiple profiles") ;
525 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; 528 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
526 if ( askforPrefs ) { 529 if ( askforPrefs ) {
527 if ( !edit_sync_options()) { 530 if ( !edit_sync_options()) {
528 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); 531 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") );
529 return; 532 return;
530 } 533 }
531 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; 534 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs;
532 } 535 }
533 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); 536 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
534 qApp->processEvents(); 537 qApp->processEvents();
535 int num = ringSync() ; 538 int num = ringSync() ;
536 if ( num > 1 ) 539 if ( num > 1 )
537 ringSync(); 540 ringSync();
538 setBlockSave(false); 541 setBlockSave(false);
539 if ( num ) 542 if ( num )
540 emit save(); 543 emit save();
541 if ( num ) 544 if ( num )
542 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); 545 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
543 else 546 else
544 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 547 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
545 return; 548 return;
546} 549}
547 550
548int KSyncManager::ringSync() 551int KSyncManager::ringSync()
549{ 552{
550 553
551 int syncedProfiles = 0; 554 int syncedProfiles = 0;
552 unsigned int i; 555 unsigned int i;
553 QTime timer; 556 QTime timer;
554 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 557 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
555 QStringList syncProfileNames = mSyncProfileNames; 558 QStringList syncProfileNames = mSyncProfileNames;
556 KSyncProfile* temp = new KSyncProfile (); 559 KSyncProfile* temp = new KSyncProfile ();
557 mAskForPreferences = false; 560 mAskForPreferences = false;
558 for ( i = 0; i < syncProfileNames.count(); ++i ) { 561 for ( i = 0; i < syncProfileNames.count(); ++i ) {
559 mCurrentSyncProfile = i; 562 mCurrentSyncProfile = i;
560 temp->setName(syncProfileNames[mCurrentSyncProfile]); 563 temp->setName(syncProfileNames[mCurrentSyncProfile]);
561 temp->readConfig(&config); 564 temp->readConfig(&config);
562 565
563 bool includeInRingSync = false; 566 bool includeInRingSync = false;
564 switch(mTargetApp) 567 switch(mTargetApp)
565 { 568 {
566 case (KAPI): 569 case (KAPI):
567 includeInRingSync = temp->getIncludeInRingSyncAB(); 570 includeInRingSync = temp->getIncludeInRingSyncAB();
568 break; 571 break;
569 case (KOPI): 572 case (KOPI):
570 includeInRingSync = temp->getIncludeInRingSync(); 573 includeInRingSync = temp->getIncludeInRingSync();
571 break; 574 break;
572 case (PWMPI): 575 case (PWMPI):
573 includeInRingSync = temp->getIncludeInRingSyncPWM(); 576 includeInRingSync = temp->getIncludeInRingSyncPWM();
574 break; 577 break;
575 default: 578 default:
576 qDebug("KSM::ringSync: invalid apptype selected"); 579 qDebug("KSM::ringSync: invalid apptype selected");
577 break; 580 break;
578 581
579 } 582 }
580 583
581 584
582 if ( includeInRingSync && ( i < 1 || i > 2 )) { 585 if ( includeInRingSync && ( i < 1 || i > 2 )) {
583 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 586 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
584 ++syncedProfiles; 587 ++syncedProfiles;
585 mSyncWithDesktop = false; 588 mSyncWithDesktop = false;
586 // mAskForPreferences = temp->getAskForPreferences(); 589 // mAskForPreferences = temp->getAskForPreferences();
587 mWriteBackFile = temp->getWriteBackFile(); 590 mWriteBackFile = temp->getWriteBackFile();
588 mWriteBackExistingOnly = temp->getWriteBackExisting(); 591 mWriteBackExistingOnly = temp->getWriteBackExisting();
589 mIsKapiFile = temp->getIsKapiFile(); 592 mIsKapiFile = temp->getIsKapiFile();
590 mWriteBackInFuture = 0; 593 mWriteBackInFuture = 0;
591 if ( temp->getWriteBackFuture() ) { 594 if ( temp->getWriteBackFuture() ) {
592 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 595 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
593 mWriteBackInPast = temp->getWriteBackPastWeeks( ); 596 mWriteBackInPast = temp->getWriteBackPastWeeks( );
594 } 597 }
595 mFilterInCal = temp->getFilterInCal(); 598 mFilterInCal = temp->getFilterInCal();
596 mFilterOutCal = temp->getFilterOutCal(); 599 mFilterOutCal = temp->getFilterOutCal();
597 mFilterInAB = temp->getFilterInAB(); 600 mFilterInAB = temp->getFilterInAB();
598 mFilterOutAB = temp->getFilterOutAB(); 601 mFilterOutAB = temp->getFilterOutAB();
599 mShowSyncSummary = false; 602 mShowSyncSummary = false;
600 mCurrentSyncDevice = syncProfileNames[i] ; 603 mCurrentSyncDevice = syncProfileNames[i] ;
601 mCurrentSyncName = mLocalMachineName; 604 mCurrentSyncName = mLocalMachineName;
602 if ( i == 0 ) { 605 if ( i == 0 ) {
603 mIsKapiFile = false; 606 mIsKapiFile = false;
604#ifdef DESKTOP_VERSION 607#ifdef DESKTOP_VERSION
605 syncKDE(); 608 syncKDE();
606#else 609#else
607 syncSharp(); 610 syncSharp();
608#endif 611#endif
609 } else { 612 } else {
610 if ( temp->getIsLocalFileSync() ) { 613 if ( temp->getIsLocalFileSync() ) {
611 switch(mTargetApp) 614 switch(mTargetApp)
612 { 615 {
613 case (KAPI): 616 case (KAPI):
614 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 617 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
615 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 618 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
616 break; 619 break;
617 case (KOPI): 620 case (KOPI):
618 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 621 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
619 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 622 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
620 break; 623 break;
621 case (PWMPI): 624 case (PWMPI):
622 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 625 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
623 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 626 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
624 break; 627 break;
625 default: 628 default:
626 qDebug("KSM: invalid apptype selected"); 629 qDebug("KSM: invalid apptype selected");
627 break; 630 break;
628 } 631 }
629 } else { 632 } else {
630 if ( temp->getIsPhoneSync() ) { 633 if ( temp->getIsPhoneSync() ) {
631 mPhoneDevice = temp->getPhoneDevice( ) ; 634 mPhoneDevice = temp->getPhoneDevice( ) ;
632 mPhoneConnection = temp->getPhoneConnection( ); 635 mPhoneConnection = temp->getPhoneConnection( );
633 mPhoneModel = temp->getPhoneModel( ); 636 mPhoneModel = temp->getPhoneModel( );
634 syncPhone(); 637 syncPhone();
635 } else if ( temp->getIsPiSync() ) { 638 } else if ( temp->getIsPiSync() ) {
636 if ( mTargetApp == KAPI ) { 639 if ( mTargetApp == KAPI ) {
637 mPassWordPiSync = temp->getRemotePwAB(); 640 mPassWordPiSync = temp->getRemotePwAB();
638 mActiveSyncPort = temp->getRemotePortAB(); 641 mActiveSyncPort = temp->getRemotePortAB();
639 mActiveSyncIP = temp->getRemoteIPAB(); 642 mActiveSyncIP = temp->getRemoteIPAB();
640 } else if ( mTargetApp == KOPI ) { 643 } else if ( mTargetApp == KOPI ) {
641 mPassWordPiSync = temp->getRemotePw(); 644 mPassWordPiSync = temp->getRemotePw();
642 mActiveSyncPort = temp->getRemotePort(); 645 mActiveSyncPort = temp->getRemotePort();
643 mActiveSyncIP = temp->getRemoteIP(); 646 mActiveSyncIP = temp->getRemoteIP();
644 } else { 647 } else {
645 mPassWordPiSync = temp->getRemotePwPWM(); 648 mPassWordPiSync = temp->getRemotePwPWM();
646 mActiveSyncPort = temp->getRemotePortPWM(); 649 mActiveSyncPort = temp->getRemotePortPWM();
647 mActiveSyncIP = temp->getRemoteIPPWM(); 650 mActiveSyncIP = temp->getRemoteIPPWM();
648 } 651 }
649 syncPi(); 652 syncPi();
650 while ( !mPisyncFinished ) { 653 while ( !mPisyncFinished ) {
651 //qDebug("waiting "); 654 //qDebug("waiting ");
652 qApp->processEvents(); 655 qApp->processEvents();
653 } 656 }
654 timer.start(); 657 timer.start();
655 while ( timer.elapsed () < 2000 ) { 658 while ( timer.elapsed () < 2000 ) {
656 qApp->processEvents(); 659 qApp->processEvents();
657 } 660 }
658 } else 661 } else
659 syncRemote( temp, false ); 662 syncRemote( temp, false );
660 663
661 } 664 }
662 } 665 }
663 timer.start(); 666 timer.start();
664 mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") ); 667 mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") );
665 while ( timer.elapsed () < 2000 ) { 668 while ( timer.elapsed () < 2000 ) {
666 qApp->processEvents(); 669 qApp->processEvents();
667#ifndef _WIN32_ 670#ifndef _WIN32_
668 sleep (1); 671 sleep (1);
669#endif 672#endif
670 } 673 }
671 674
672 } 675 }
673 676
674 } 677 }
675 delete temp; 678 delete temp;
676 return syncedProfiles; 679 return syncedProfiles;
677} 680}
678 681
679void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) 682void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
680{ 683{
681 QString question; 684 QString question;
682 if ( ask ) { 685 if ( ask ) {
683 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 686 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
684 if ( QMessageBox::information( mParent, i18n("Sync"), 687 if ( QMessageBox::information( mParent, i18n("Sync"),
685 question, 688 question,
686 i18n("Yes"), i18n("No"), 689 i18n("Yes"), i18n("No"),
687 0, 0 ) != 0 ) 690 0, 0 ) != 0 )
688 return; 691 return;
689 } 692 }
690 693
691 QString preCommand; 694 QString preCommand;
692 QString localTempFile; 695 QString localTempFile;
693 QString postCommand; 696 QString postCommand;
694 697
695 switch(mTargetApp) 698 switch(mTargetApp)
696 { 699 {
697 case (KAPI): 700 case (KAPI):
698 preCommand = prof->getPreSyncCommandAB(); 701 preCommand = prof->getPreSyncCommandAB();
699 postCommand = prof->getPostSyncCommandAB(); 702 postCommand = prof->getPostSyncCommandAB();
700 localTempFile = prof->getLocalTempFileAB(); 703 localTempFile = prof->getLocalTempFileAB();
701 break; 704 break;
702 case (KOPI): 705 case (KOPI):
703 preCommand = prof->getPreSyncCommand(); 706 preCommand = prof->getPreSyncCommand();
704 postCommand = prof->getPostSyncCommand(); 707 postCommand = prof->getPostSyncCommand();
705 localTempFile = prof->getLocalTempFile(); 708 localTempFile = prof->getLocalTempFile();
706 break; 709 break;
707 case (PWMPI): 710 case (PWMPI):
708 preCommand = prof->getPreSyncCommandPWM(); 711 preCommand = prof->getPreSyncCommandPWM();
709 postCommand = prof->getPostSyncCommandPWM(); 712 postCommand = prof->getPostSyncCommandPWM();
710 localTempFile = prof->getLocalTempFilePWM(); 713 localTempFile = prof->getLocalTempFilePWM();
711 break; 714 break;
712 default: 715 default:
713 qDebug("KSM::syncRemote: invalid apptype selected"); 716 qDebug("KSM::syncRemote: invalid apptype selected");
714 break; 717 break;
715 } 718 }
716 719
717 720
718 int fi; 721 int fi;
719 if ( (fi = preCommand.find("$PWD$")) > 0 ) { 722 if ( (fi = preCommand.find("$PWD$")) > 0 ) {
720 QString pwd = getPassword(); 723 QString pwd = getPassword();
721 preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); 724 preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 );
722 725
723 } 726 }
724 int maxlen = 30; 727 int maxlen = 30;
725 if ( QApplication::desktop()->width() > 320 ) 728 if ( QApplication::desktop()->width() > 320 )
726 maxlen += 25; 729 maxlen += 25;
727 mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); 730 mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) );
728 int fileSize = 0; 731 int fileSize = 0;
729 int result = system ( preCommand ); 732 int result = system ( preCommand );
730 // 0 : okay 733 // 0 : okay
731 // 256: no such file or dir 734 // 256: no such file or dir
732 // 735 //
733 qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result ); 736 qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result );
734 if ( result != 0 ) { 737 if ( result != 0 ) {
735 unsigned int len = maxlen; 738 unsigned int len = maxlen;
736 while ( len < preCommand.length() ) { 739 while ( len < preCommand.length() ) {
737 preCommand.insert( len , "\n" ); 740 preCommand.insert( len , "\n" );
738 len += maxlen +2; 741 len += maxlen +2;
739 } 742 }
740 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; 743 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ;
741 QMessageBox::information( mParent, i18n("Sync - ERROR"), 744 QMessageBox::information( mParent, i18n("Sync - ERROR"),
742 question, 745 question,
743 i18n("Okay!")) ; 746 i18n("Okay!")) ;
744 mParent->topLevelWidget()->setCaption ("KDE-Pim"); 747 mParent->topLevelWidget()->setCaption ("KDE-Pim");
745 return; 748 return;
746 } 749 }
747 mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); 750 mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) );
748 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); 751 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
749 752
750 if ( syncWithFile( localTempFile, true ) ) { 753 if ( syncWithFile( localTempFile, true ) ) {
751 754
752 if ( mWriteBackFile ) { 755 if ( mWriteBackFile ) {
753 int fi; 756 int fi;
754 if ( (fi = postCommand.find("$PWD$")) > 0 ) { 757 if ( (fi = postCommand.find("$PWD$")) > 0 ) {
755 QString pwd = getPassword(); 758 QString pwd = getPassword();
756 postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); 759 postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 );
757 760
758 } 761 }
759 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); 762 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) );
760 result = system ( postCommand ); 763 result = system ( postCommand );
761 qDebug("KSM::Sync:Writing back file result: %d ", result); 764 qDebug("KSM::Sync:Writing back file result: %d ", result);
762 if ( result != 0 ) { 765 if ( result != 0 ) {
763 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 766 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
764 return; 767 return;
765 } else { 768 } else {
766 mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); 769 mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) );
767 } 770 }
768 } 771 }
769 } 772 }
770 return; 773 return;
771} 774}
772bool KSyncManager::edit_pisync_options() 775bool KSyncManager::edit_pisync_options()
773{ 776{
774 QDialog dia( mParent, "dia", true ); 777 QDialog dia( mParent, "dia", true );
775 dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); 778 dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice );
776 QVBoxLayout lay ( &dia ); 779 QVBoxLayout lay ( &dia );
777 lay.setSpacing( 5 ); 780 lay.setSpacing( 5 );
778 lay.setMargin( 3 ); 781 lay.setMargin( 3 );
779 QLabel lab1 ( i18n("Password for remote access:"), &dia); 782 QLabel lab1 ( i18n("Password for remote access:"), &dia);
780 lay.addWidget( &lab1 ); 783 lay.addWidget( &lab1 );
781 QLineEdit le1 (&dia ); 784 QLineEdit le1 (&dia );
782 lay.addWidget( &le1 ); 785 lay.addWidget( &le1 );
783 QLabel lab2 ( i18n("Remote IP address:"), &dia); 786 QLabel lab2 ( i18n("Remote IP address:"), &dia);
784 lay.addWidget( &lab2 ); 787 lay.addWidget( &lab2 );
785 QLineEdit le2 (&dia ); 788 QLineEdit le2 (&dia );
786 lay.addWidget( &le2 ); 789 lay.addWidget( &le2 );
787 QLabel lab3 ( i18n("Remote port number:"), &dia); 790 QLabel lab3 ( i18n("Remote port number:"), &dia);
788 lay.addWidget( &lab3 ); 791 lay.addWidget( &lab3 );
789 QLineEdit le3 (&dia ); 792 QLineEdit le3 (&dia );
790 lay.addWidget( &le3 ); 793 lay.addWidget( &le3 );
791 QPushButton pb ( "OK", &dia); 794 QPushButton pb ( "OK", &dia);
792 lay.addWidget( &pb ); 795 lay.addWidget( &pb );
793 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 796 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
794 le1.setText( mPassWordPiSync ); 797 le1.setText( mPassWordPiSync );
795 le2.setText( mActiveSyncIP ); 798 le2.setText( mActiveSyncIP );
796 le3.setText( mActiveSyncPort ); 799 le3.setText( mActiveSyncPort );
797 if ( dia.exec() ) { 800 if ( dia.exec() ) {
798 mPassWordPiSync = le1.text(); 801 mPassWordPiSync = le1.text();
799 mActiveSyncPort = le3.text(); 802 mActiveSyncPort = le3.text();
800 mActiveSyncIP = le2.text(); 803 mActiveSyncIP = le2.text();
801 return true; 804 return true;
802 } 805 }
803 return false; 806 return false;
804} 807}
805bool KSyncManager::edit_sync_options() 808bool KSyncManager::edit_sync_options()
806{ 809{
807 810
808 QDialog dia( mParent, "dia", true ); 811 QDialog dia( mParent, "dia", true );
809 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); 812 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
810 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); 813 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
811 QVBoxLayout lay ( &dia ); 814 QVBoxLayout lay ( &dia );
812 lay.setSpacing( 2 ); 815 lay.setSpacing( 2 );
813 lay.setMargin( 3 ); 816 lay.setMargin( 3 );
814 lay.addWidget(&gr); 817 lay.addWidget(&gr);
815 QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); 818 QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
816 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); 819 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
817 QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); 820 QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
818 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); 821 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
819 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); 822 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
820 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); 823 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
821 //QRadioButton both( i18n("Take both on conflict"), &gr ); 824 //QRadioButton both( i18n("Take both on conflict"), &gr );
822 QPushButton pb ( "OK", &dia); 825 QPushButton pb ( "OK", &dia);
823 lay.addWidget( &pb ); 826 lay.addWidget( &pb );
824 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 827 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
825 switch ( mSyncAlgoPrefs ) { 828 switch ( mSyncAlgoPrefs ) {
826 case 0: 829 case 0:
827 loc.setChecked( true); 830 loc.setChecked( true);
828 break; 831 break;
829 case 1: 832 case 1:
830 rem.setChecked( true ); 833 rem.setChecked( true );
831 break; 834 break;
832 case 2: 835 case 2:
833 newest.setChecked( true); 836 newest.setChecked( true);
834 break; 837 break;
835 case 3: 838 case 3:
836 ask.setChecked( true); 839 ask.setChecked( true);
837 break; 840 break;
838 case 4: 841 case 4:
839 f_loc.setChecked( true); 842 f_loc.setChecked( true);
840 break; 843 break;
841 case 5: 844 case 5:
842 f_rem.setChecked( true); 845 f_rem.setChecked( true);
843 break; 846 break;
844 case 6: 847 case 6:
845 // both.setChecked( true); 848 // both.setChecked( true);
846 break; 849 break;
847 default: 850 default:
848 break; 851 break;
849 } 852 }
850 if ( dia.exec() ) { 853 if ( dia.exec() ) {
851 mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; 854 mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
852 return true; 855 return true;
853 } 856 }
854 return false; 857 return false;
855} 858}
856 859
857QString KSyncManager::getPassword( ) 860QString KSyncManager::getPassword( )
858{ 861{
859 QString retfile = ""; 862 QString retfile = "";
860 QDialog dia ( mParent, "input-dialog", true ); 863 QDialog dia ( mParent, "input-dialog", true );
861 QLineEdit lab ( &dia ); 864 QLineEdit lab ( &dia );
862 lab.setEchoMode( QLineEdit::Password ); 865 lab.setEchoMode( QLineEdit::Password );
863 QVBoxLayout lay( &dia ); 866 QVBoxLayout lay( &dia );
864 lay.setMargin(7); 867 lay.setMargin(7);
865 lay.setSpacing(7); 868 lay.setSpacing(7);
866 lay.addWidget( &lab); 869 lay.addWidget( &lab);
867 dia.setFixedSize( 230,50 ); 870 dia.setFixedSize( 230,50 );
868 dia.setCaption( i18n("Enter password") ); 871 dia.setCaption( i18n("Enter password") );
869 QPushButton pb ( "OK", &dia); 872 QPushButton pb ( "OK", &dia);
870 lay.addWidget( &pb ); 873 lay.addWidget( &pb );
871 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 874 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
872 dia.show(); 875 dia.show();
873 int res = dia.exec(); 876 int res = dia.exec();
874 if ( res ) 877 if ( res )
875 retfile = lab.text(); 878 retfile = lab.text();
876 dia.hide(); 879 dia.hide();
877 qApp->processEvents(); 880 qApp->processEvents();
878 return retfile; 881 return retfile;
879 882
880} 883}
881 884
882 885
883void KSyncManager::confSync() 886void KSyncManager::confSync()
884{ 887{
885 static KSyncPrefsDialog* sp = 0; 888 static KSyncPrefsDialog* sp = 0;
886 if ( ! sp ) { 889 if ( ! sp ) {
887 sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); 890 sp = new KSyncPrefsDialog( mParent, "syncprefs", true );
888 } 891 }
889 sp->usrReadConfig(); 892 sp->usrReadConfig();
890#ifndef DESKTOP_VERSION 893#ifndef DESKTOP_VERSION
891 sp->showMaximized(); 894 sp->showMaximized();
892#else 895#else
893 sp->show(); 896 sp->show();
894#endif 897#endif
895 sp->exec(); 898 sp->exec();
896 QStringList oldSyncProfileNames = mSyncProfileNames; 899 QStringList oldSyncProfileNames = mSyncProfileNames;
897 mSyncProfileNames = sp->getSyncProfileNames(); 900 mSyncProfileNames = sp->getSyncProfileNames();
898 mLocalMachineName = sp->getLocalMachineName (); 901 mLocalMachineName = sp->getLocalMachineName ();
899 int ii; 902 int ii;
900 for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { 903 for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) {
901 if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) 904 if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) )
902 mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); 905 mImplementation->removeSyncInfo( oldSyncProfileNames[ii] );
903 } 906 }
904 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 907 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
905} 908}
906void KSyncManager::syncKDE() 909void KSyncManager::syncKDE()
907{ 910{
908 mSyncWithDesktop = true; 911 mSyncWithDesktop = true;
909 emit save(); 912 emit save();
910 switch(mTargetApp) 913 switch(mTargetApp)
911 { 914 {
912 case (KAPI): 915 case (KAPI):
913 { 916 {
914#ifdef DESKTOP_VERSION 917#ifdef DESKTOP_VERSION
915 QString command = qApp->applicationDirPath () + "/kdeabdump"; 918 QString command = qApp->applicationDirPath () + "/kdeabdump";
916#else 919#else
917 QString command = "kdeabdump"; 920 QString command = "kdeabdump";
918#endif 921#endif
919 if ( ! QFile::exists ( command ) ) 922 if ( ! QFile::exists ( command ) )
920 command = "kdeabdump"; 923 command = "kdeabdump";
921 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; 924 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf";
922 system ( command.latin1()); 925 system ( command.latin1());
923 if ( syncWithFile( fileName,true ) ) { 926 if ( syncWithFile( fileName,true ) ) {
924 if ( mWriteBackFile ) { 927 if ( mWriteBackFile ) {
925 command += " --read"; 928 command += " --read";
926 system ( command.latin1()); 929 system ( command.latin1());
927 } 930 }
928 } 931 }
929 932
930 } 933 }
931 break; 934 break;
932 case (KOPI): 935 case (KOPI):
933 { 936 {
934#ifdef DESKTOP_VERSION 937#ifdef DESKTOP_VERSION
935 QString command = qApp->applicationDirPath () + "/kdecaldump"; 938 QString command = qApp->applicationDirPath () + "/kdecaldump";
936#else 939#else
937 QString command = "kdecaldump"; 940 QString command = "kdecaldump";
938#endif 941#endif
939 if ( ! QFile::exists ( command ) ) 942 if ( ! QFile::exists ( command ) )
940 command = "kdecaldump"; 943 command = "kdecaldump";
941 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; 944 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
942 system ( command.latin1()); 945 system ( command.latin1());
943 if ( syncWithFile( fileName,true ) ) { 946 if ( syncWithFile( fileName,true ) ) {
944 if ( mWriteBackFile ) { 947 if ( mWriteBackFile ) {
945 command += " --read"; 948 command += " --read";
946 system ( command.latin1()); 949 system ( command.latin1());
947 } 950 }
948 } 951 }
949 952
950 } 953 }
951 break; 954 break;
952 case (PWMPI): 955 case (PWMPI):
953 956
954 break; 957 break;
955 default: 958 default:
956 qDebug("KSM::slotSyncMenu: invalid apptype selected"); 959 qDebug("KSM::slotSyncMenu: invalid apptype selected");
957 break; 960 break;
958 961
959 } 962 }
960} 963}
961 964
962void KSyncManager::syncSharp() 965void KSyncManager::syncSharp()
963{ 966{
964 967
965 if ( ! syncExternalApplication("sharp") ) 968 if ( ! syncExternalApplication("sharp") )
966 qDebug("KSM::ERROR sync sharp "); 969 qDebug("KSM::ERROR sync sharp ");
967} 970}
968 971
969bool KSyncManager::syncExternalApplication(QString resource) 972bool KSyncManager::syncExternalApplication(QString resource)
970{ 973{
971 974
972 emit save(); 975 emit save();
973 976
974 if ( mAskForPreferences ) 977 if ( mAskForPreferences )
975 if ( !edit_sync_options()) { 978 if ( !edit_sync_options()) {
976 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 979 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
977 return false; 980 return false;
978 } 981 }
979 982
980 qDebug("KSM::Sync extern %s", resource.latin1()); 983 qDebug("KSM::Sync extern %s", resource.latin1());
981 984
982 bool syncOK = mImplementation->syncExternal(this, resource); 985 bool syncOK = mImplementation->syncExternal(this, resource);
983 986
984 return syncOK; 987 return syncOK;
985 988
986} 989}
987 990
988void KSyncManager::syncPhone() 991void KSyncManager::syncPhone()
989{ 992{
990 993
991 syncExternalApplication("phone"); 994 syncExternalApplication("phone");
992 995
993} 996}
994 997
995void KSyncManager::showProgressBar(int percentage, QString caption, int total) 998void KSyncManager::showProgressBar(int percentage, QString caption, int total)
996{ 999{
997 if (!bar->isVisible()) 1000 if (!bar->isVisible())
998 { 1001 {
999 bar->setCaption (caption); 1002 bar->setCaption (caption);
1000 bar->setTotalSteps ( total ) ; 1003 bar->setTotalSteps ( total ) ;
1001 bar->show(); 1004 bar->show();
1002 } 1005 }
1003 bar->raise(); 1006 bar->raise();
1004 bar->setProgress( percentage ); 1007 bar->setProgress( percentage );
1005 qApp->processEvents(); 1008 qApp->processEvents();
1006} 1009}
1007 1010
1008void KSyncManager::hideProgressBar() 1011void KSyncManager::hideProgressBar()
1009{ 1012{
1010 bar->hide(); 1013 bar->hide();
1011 qApp->processEvents(); 1014 qApp->processEvents();
1012} 1015}
1013 1016
1014bool KSyncManager::isProgressBarCanceled() 1017bool KSyncManager::isProgressBarCanceled()
1015{ 1018{
1016 return !bar->isVisible(); 1019 return !bar->isVisible();
1017} 1020}
1018 1021
1019QString KSyncManager::syncFileName() 1022QString KSyncManager::syncFileName()
1020{ 1023{
1021 1024
1022 QString fn = "tempfile"; 1025 QString fn = "tempfile";
1023 switch(mTargetApp) 1026 switch(mTargetApp)
1024 { 1027 {
1025 case (KAPI): 1028 case (KAPI):
1026 fn = "tempsyncab.vcf"; 1029 fn = "tempsyncab.vcf";
1027 break; 1030 break;
1028 case (KOPI): 1031 case (KOPI):
1029 fn = "tempsynccal.ics"; 1032 fn = "tempsynccal.ics";
1030 break; 1033 break;
1031 case (PWMPI): 1034 case (PWMPI):
1032 fn = "tempsyncpw.pwm"; 1035 fn = "tempsyncpw.pwm";
1033 break; 1036 break;
1034 default: 1037 default:
1035 break; 1038 break;
1036 } 1039 }
1037#ifdef _WIN32_ 1040#ifdef _WIN32_
1038 return locateLocal( "tmp", fn ); 1041 return locateLocal( "tmp", fn );
1039#else 1042#else
1040 return (QString( "/tmp/" )+ fn ); 1043 return (QString( "/tmp/" )+ fn );
1041#endif 1044#endif
1042} 1045}
1043 1046
1044void KSyncManager::syncPi() 1047void KSyncManager::syncPi()
1045{ 1048{
1046 mIsKapiFile = true; 1049 mIsKapiFile = true;
1047 mPisyncFinished = false; 1050 mPisyncFinished = false;
1048 qApp->processEvents(); 1051 qApp->processEvents();
1049 if ( mAskForPreferences ) 1052 if ( mAskForPreferences )
1050 if ( !edit_pisync_options()) { 1053 if ( !edit_pisync_options()) {
1051 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 1054 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
1052 return; 1055 return;
1053 } 1056 }
1054 bool ok; 1057 bool ok;
1055 Q_UINT16 port = mActiveSyncPort.toUInt(&ok); 1058 Q_UINT16 port = mActiveSyncPort.toUInt(&ok);
1056 if ( ! ok ) { 1059 if ( ! ok ) {
1057 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); 1060 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
1058 return; 1061 return;
1059 } 1062 }
1060 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); 1063 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
1061 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 1064 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
1062 commandSocket->readFile( syncFileName() ); 1065 commandSocket->readFile( syncFileName() );
1063} 1066}
1064 1067
1065void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) 1068void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
1066{ 1069{
1067 //enum { success, errorW, errorR, quiet }; 1070 //enum { success, errorW, errorR, quiet };
1068 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { 1071 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) {
1069 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); 1072 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") );
1070 delete s; 1073 delete s;
1071 if ( state == KCommandSocket::errorR ) { 1074 if ( state == KCommandSocket::errorR ) {
1072 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); 1075 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget());
1073 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1076 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1074 commandSocket->sendStop(); 1077 commandSocket->sendStop();
1075 } 1078 }
1076 mPisyncFinished = true; 1079 mPisyncFinished = true;
1077 return; 1080 return;
1078 1081
1079 } else if ( state == KCommandSocket::errorW ) { 1082 } else if ( state == KCommandSocket::errorW ) {
1080 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); 1083 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") );
1081 mPisyncFinished = true; 1084 mPisyncFinished = true;
1082 1085
1083 } else if ( state == KCommandSocket::successR ) { 1086 } else if ( state == KCommandSocket::successR ) {
1084 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); 1087 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
1085 1088
1086 } else if ( state == KCommandSocket::successW ) { 1089 } else if ( state == KCommandSocket::successW ) {
1087 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 1090 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
1088 mPisyncFinished = true; 1091 mPisyncFinished = true;
1089 } 1092 }
1090 1093
1091 delete s; 1094 delete s;
1092} 1095}
1093 1096
1094void KSyncManager::readFileFromSocket() 1097void KSyncManager::readFileFromSocket()
1095{ 1098{
1096 QString fileName = syncFileName(); 1099 QString fileName = syncFileName();
1097 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); 1100 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
1098 if ( ! syncWithFile( fileName , true ) ) { 1101 if ( ! syncWithFile( fileName , true ) ) {
1099 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); 1102 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") );
1100 mPisyncFinished = true; 1103 mPisyncFinished = true;
1101 return; 1104 return;
1102 } 1105 }
1103 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); 1106 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() );
1104 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1107 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1105 if ( mWriteBackFile ) 1108 if ( mWriteBackFile )
1106 commandSocket->writeFile( fileName ); 1109 commandSocket->writeFile( fileName );
1107 else { 1110 else {
1108 commandSocket->sendStop(); 1111 commandSocket->sendStop();
1109 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 1112 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
1110 mPisyncFinished = true; 1113 mPisyncFinished = true;
1111 } 1114 }
1112} 1115}
1113 1116
1114KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) 1117KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
1115{ 1118{
1116 mPassWord = pw; 1119 mPassWord = pw;
1117 mSocket = 0; 1120 mSocket = 0;
1118 mSyncActionDialog = 0; 1121 mSyncActionDialog = 0;
1119 blockRC = false; 1122 blockRC = false;
1120}; 1123}
1121 1124
1122void KServerSocket::newConnection ( int socket ) 1125void KServerSocket::newConnection ( int socket )
1123{ 1126{
1124 // qDebug("KServerSocket:New connection %d ", socket); 1127 // qDebug("KServerSocket:New connection %d ", socket);
1125 if ( mSocket ) { 1128 if ( mSocket ) {
1126 qDebug("KSS::newConnection Socket deleted! "); 1129 qDebug("KSS::newConnection Socket deleted! ");
1127 delete mSocket; 1130 delete mSocket;
1128 mSocket = 0; 1131 mSocket = 0;
1129 } 1132 }
1130 mSocket = new QSocket( this ); 1133 mSocket = new QSocket( this );
1131 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); 1134 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
1132 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 1135 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
1133 mSocket->setSocket( socket ); 1136 mSocket->setSocket( socket );
1134} 1137}
1135 1138
1136void KServerSocket::discardClient() 1139void KServerSocket::discardClient()
1137{ 1140{
1138 //qDebug(" KServerSocket::discardClient()"); 1141 //qDebug(" KServerSocket::discardClient()");
1139 if ( mSocket ) { 1142 if ( mSocket ) {
1140 delete mSocket; 1143 delete mSocket;
1141 mSocket = 0; 1144 mSocket = 0;
1142 } 1145 }
1143 //emit endConnect(); 1146 //emit endConnect();
1144} 1147}
1145void KServerSocket::readClient() 1148void KServerSocket::readClient()
1146{ 1149{
1147 if ( blockRC ) 1150 if ( blockRC )
1148 return; 1151 return;
1149 if ( mSocket == 0 ) { 1152 if ( mSocket == 0 ) {
1150 qDebug("ERROR::KSS::readClient(): mSocket == 0 "); 1153 qDebug("ERROR::KSS::readClient(): mSocket == 0 ");
1151 return; 1154 return;
1152 } 1155 }
1153 //qDebug("KServerSocket::readClient()"); 1156 //qDebug("KServerSocket::readClient()");
1154 if ( mSocket->canReadLine() ) { 1157 if ( mSocket->canReadLine() ) {
1155 QString line = mSocket->readLine(); 1158 QString line = mSocket->readLine();
1156 //qDebug("KServerSocket readline: %s ", line.latin1()); 1159 //qDebug("KServerSocket readline: %s ", line.latin1());
1157 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); 1160 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
1158 if ( tokens[0] == "GET" ) { 1161 if ( tokens[0] == "GET" ) {
1159 if ( tokens[1] == mPassWord ) { 1162 if ( tokens[1] == mPassWord ) {
1160 //emit sendFile( mSocket ); 1163 //emit sendFile( mSocket );
1161 bool ok = false; 1164 bool ok = false;
1162 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); 1165 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok);
1163 if ( ok ) { 1166 if ( ok ) {
1164 KSyncManager::mRequestedSyncEvent = dt; 1167 KSyncManager::mRequestedSyncEvent = dt;
1165 } 1168 }
1166 else 1169 else
1167 KSyncManager::mRequestedSyncEvent = QDateTime(); 1170 KSyncManager::mRequestedSyncEvent = QDateTime();
1168 send_file(); 1171 send_file();
1169 } 1172 }
1170 else { 1173 else {
1171 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); 1174 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"));
1172 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1175 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1173 } 1176 }
1174 } 1177 }
1175 if ( tokens[0] == "PUT" ) { 1178 if ( tokens[0] == "PUT" ) {
1176 if ( tokens[1] == mPassWord ) { 1179 if ( tokens[1] == mPassWord ) {
1177 //emit getFile( mSocket ); 1180 //emit getFile( mSocket );
1178 blockRC = true; 1181 blockRC = true;
1179 get_file(); 1182 get_file();
1180 } 1183 }
1181 else { 1184 else {
1182 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); 1185 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"));
1183 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1186 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1184 } 1187 }
1185 } 1188 }
1186 if ( tokens[0] == "STOP" ) { 1189 if ( tokens[0] == "STOP" ) {
1187 //emit endConnect(); 1190 //emit endConnect();
1188 end_connect(); 1191 end_connect();
1189 } 1192 }
1190 } 1193 }
1191} 1194}
1192void KServerSocket::end_connect() 1195void KServerSocket::end_connect()
1193{ 1196{
1194 delete mSyncActionDialog; 1197 delete mSyncActionDialog;
1195 mSyncActionDialog = 0; 1198 mSyncActionDialog = 0;
1196} 1199}
1197void KServerSocket::send_file() 1200void KServerSocket::send_file()
1198{ 1201{
1199 //qDebug("MainWindow::sendFile(QSocket* s) "); 1202 //qDebug("MainWindow::sendFile(QSocket* s) ");
1200 if ( mSyncActionDialog ) 1203 if ( mSyncActionDialog )
1201 delete mSyncActionDialog; 1204 delete mSyncActionDialog;
1202 mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); 1205 mSyncActionDialog = new QDialog ( 0, "input-dialog", true );
1203 mSyncActionDialog->setCaption(i18n("Received sync request")); 1206 mSyncActionDialog->setCaption(i18n("Received sync request"));
1204 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); 1207 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
1205 label->setAlignment ( Qt::AlignHCenter ); 1208 label->setAlignment ( Qt::AlignHCenter );
1206 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); 1209 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
1207 lay->addWidget( label); 1210 lay->addWidget( label);
1208 lay->setMargin(7); 1211 lay->setMargin(7);
1209 lay->setSpacing(7); 1212 lay->setSpacing(7);
1210 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1213 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
1211 int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); 1214 int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent );
1212 if ( secs < 0 ) 1215 if ( secs < 0 )
1213 secs = secs * (-1); 1216 secs = secs * (-1);
1214 if ( secs > 30 ) 1217 if ( secs > 30 )
1215 //if ( true ) 1218 //if ( true )
1216 { 1219 {
1217 QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); 1220 QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs );
1218 QLabel* label = new QLabel( warning, mSyncActionDialog ); 1221 QLabel* label = new QLabel( warning, mSyncActionDialog );
1219 label->setAlignment ( Qt::AlignHCenter ); 1222 label->setAlignment ( Qt::AlignHCenter );
1220 lay->addWidget( label); 1223 lay->addWidget( label);
1221 if ( secs > 180 ) 1224 if ( secs > 180 )
1222 { 1225 {
1223 if ( secs > 300 ) { 1226 if ( secs > 300 ) {
1224 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { 1227 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) {
1225 qDebug("KSS::Sync cancelled ,cs"); 1228 qDebug("KSS::Sync cancelled ,cs");
1226 return ; 1229 return ;
1227 } 1230 }
1228 } 1231 }
1229 QFont f = label->font(); 1232 QFont f = label->font();
1230 f.setPointSize ( f.pointSize() *2 ); 1233 f.setPointSize ( f.pointSize() *2 );
1231 f. setBold (true ); 1234 f. setBold (true );
1232 QLabel* label = new QLabel( warning, mSyncActionDialog ); 1235 QLabel* label = new QLabel( warning, mSyncActionDialog );
1233 label->setFont( f ); 1236 label->setFont( f );
1234 warning = i18n("ADJUST\nYOUR\nCLOCKS!"); 1237 warning = i18n("ADJUST\nYOUR\nCLOCKS!");
1235 label->setText( warning ); 1238 label->setText( warning );
1236 label->setAlignment ( Qt::AlignHCenter ); 1239 label->setAlignment ( Qt::AlignHCenter );
1237 lay->addWidget( label); 1240 lay->addWidget( label);
1238 mSyncActionDialog->setFixedSize( 230, 300); 1241 mSyncActionDialog->setFixedSize( 230, 300);
1239 } else { 1242 } else {
1240 mSyncActionDialog->setFixedSize( 230, 200); 1243 mSyncActionDialog->setFixedSize( 230, 200);
1241 } 1244 }
1242 } else { 1245 } else {
1243 mSyncActionDialog->setFixedSize( 230, 120); 1246 mSyncActionDialog->setFixedSize( 230, 120);
1244 } 1247 }
1245 } else 1248 } else
1246 mSyncActionDialog->setFixedSize( 230, 120); 1249 mSyncActionDialog->setFixedSize( 230, 120);
1247 mSyncActionDialog->show(); 1250 mSyncActionDialog->show();
1248 mSyncActionDialog->raise(); 1251 mSyncActionDialog->raise();
1249 emit request_file(); 1252 emit request_file();
1250 qApp->processEvents(); 1253 qApp->processEvents();
1251 QString fileName = mFileName; 1254 QString fileName = mFileName;
1252 QFile file( fileName ); 1255 QFile file( fileName );
1253 if (!file.open( IO_ReadOnly ) ) { 1256 if (!file.open( IO_ReadOnly ) ) {
1254 delete mSyncActionDialog; 1257 delete mSyncActionDialog;
1255 mSyncActionDialog = 0; 1258 mSyncActionDialog = 0;
1256 qDebug("KSS::error open sync file: %s ", fileName.latin1()); 1259 qDebug("KSS::error open sync file: %s ", fileName.latin1());
1257 mSocket->close(); 1260 mSocket->close();
1258 if ( mSocket->state() == QSocket::Idle ) 1261 if ( mSocket->state() == QSocket::Idle )
1259 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1262 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1260 return ; 1263 return ;
1261 1264
1262 } 1265 }
1263 mSyncActionDialog->setCaption( i18n("Sending file...") ); 1266 mSyncActionDialog->setCaption( i18n("Sending file...") );
1264 QTextStream ts( &file ); 1267 QTextStream ts( &file );
1265 ts.setEncoding( QTextStream::Latin1 ); 1268 ts.setEncoding( QTextStream::Latin1 );
1266 1269
1267 QTextStream os( mSocket ); 1270 QTextStream os( mSocket );
1268 os.setEncoding( QTextStream::Latin1 ); 1271 os.setEncoding( QTextStream::Latin1 );
1269 while ( ! ts.atEnd() ) { 1272 while ( ! ts.atEnd() ) {
1270 os << ts.readLine() << "\r\n\r\n"; 1273 os << ts.readLine() << "\r\n\r\n";
1271 } 1274 }
1272 //os << ts.read(); 1275 //os << ts.read();
1273 file.close(); 1276 file.close();
1274 mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); 1277 mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
1275 mSocket->close(); 1278 mSocket->close();
1276 if ( mSocket->state() == QSocket::Idle ) 1279 if ( mSocket->state() == QSocket::Idle )
1277 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1280 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1278} 1281}
1279void KServerSocket::get_file() 1282void KServerSocket::get_file()
1280{ 1283{
1281 mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); 1284 mSyncActionDialog->setCaption( i18n("Receiving synced file...") );
1282 1285
1283 piTime.start(); 1286 piTime.start();
1284 piFileString = ""; 1287 piFileString = "";
1285 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); 1288 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) ));
1286} 1289}
1287 1290
1288 1291
1289void KServerSocket::readBackFileFromSocket() 1292void KServerSocket::readBackFileFromSocket()
1290{ 1293{
1291 //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); 1294 //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
1292 while ( mSocket->canReadLine () ) { 1295 while ( mSocket->canReadLine () ) {
1293 piTime.restart(); 1296 piTime.restart();
1294 QString line = mSocket->readLine (); 1297 QString line = mSocket->readLine ();
1295 piFileString += line; 1298 piFileString += line;
1296 //qDebug("readline: %s ", line.latin1()); 1299 //qDebug("readline: %s ", line.latin1());
1297 mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); 1300 mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) );
1298 1301
1299 } 1302 }
1300 if ( piTime.elapsed () < 3000 ) { 1303 if ( piTime.elapsed () < 3000 ) {
1301 // wait for more 1304 // wait for more
1302 //qDebug("waitformore "); 1305 //qDebug("waitformore ");
1303 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); 1306 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) ));
1304 return; 1307 return;
1305 } 1308 }
1306 QString fileName = mFileName; 1309 QString fileName = mFileName;
1307 QFile file ( fileName ); 1310 QFile file ( fileName );
1308 if (!file.open( IO_WriteOnly ) ) { 1311 if (!file.open( IO_WriteOnly ) ) {
1309 delete mSyncActionDialog; 1312 delete mSyncActionDialog;
1310 mSyncActionDialog = 0; 1313 mSyncActionDialog = 0;
1311 qDebug("KSS:Error open read back file "); 1314 qDebug("KSS:Error open read back file ");
1312 piFileString = ""; 1315 piFileString = "";
1313 emit file_received( false ); 1316 emit file_received( false );
1314 blockRC = false; 1317 blockRC = false;
1315 return ; 1318 return ;
1316 1319
1317 } 1320 }
1318 1321
1319 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1322 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1320 QTextStream ts ( &file ); 1323 QTextStream ts ( &file );
1321 ts.setEncoding( QTextStream::Latin1 ); 1324 ts.setEncoding( QTextStream::Latin1 );
1322 mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); 1325 mSyncActionDialog->setCaption( i18n("Writing file to disk...") );
1323 ts << piFileString; 1326 ts << piFileString;
1324 mSocket->close(); 1327 mSocket->close();
1325 if ( mSocket->state() == QSocket::Idle ) 1328 if ( mSocket->state() == QSocket::Idle )
1326 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1329 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1327 file.close(); 1330 file.close();
1328 piFileString = ""; 1331 piFileString = "";
1329 emit file_received( true ); 1332 emit file_received( true );
1330 delete mSyncActionDialog; 1333 delete mSyncActionDialog;
1331 mSyncActionDialog = 0; 1334 mSyncActionDialog = 0;
1332 blockRC = false; 1335 blockRC = false;
1333 1336
1334} 1337}
1335 1338
1336KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) 1339KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name )
1337{ 1340{
1338 mPassWord = password; 1341 mPassWord = password;
1339 mSocket = 0; 1342 mSocket = 0;
1340 mFirst = false; 1343 mFirst = false;
1341 mPort = port; 1344 mPort = port;
1342 mHost = host; 1345 mHost = host;
1343 tlw = cap; 1346 tlw = cap;
1344 mRetVal = quiet; 1347 mRetVal = quiet;
1345 mTimerSocket = new QTimer ( this ); 1348 mTimerSocket = new QTimer ( this );
1346 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); 1349 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) );
1347} 1350}
1348void KCommandSocket::sendFileRequest() 1351void KCommandSocket::sendFileRequest()
1349{ 1352{
1350 if ( tlw ) 1353 if ( tlw )
1351 tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); 1354 tlw->setCaption( i18n("Connected! Sending request for remote file ...") );
1352 mTimerSocket->start( 300000 ); 1355 mTimerSocket->start( 300000 );
1353 QTextStream os( mSocket ); 1356 QTextStream os( mSocket );
1354 os.setEncoding( QTextStream::Latin1 ); 1357 os.setEncoding( QTextStream::Latin1 );
1355 1358
1356 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); 1359 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
1357 os << "GET " << mPassWord << curDt <<"\r\n\r\n"; 1360 os << "GET " << mPassWord << curDt <<"\r\n\r\n";
1358} 1361}
1359 1362
1360void KCommandSocket::readFile( QString fn ) 1363void KCommandSocket::readFile( QString fn )
1361{ 1364{
1362 if ( !mSocket ) { 1365 if ( !mSocket ) {
1363 mSocket = new QSocket( this ); 1366 mSocket = new QSocket( this );
1364 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); 1367 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
1365 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1368 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1366 connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() )); 1369 connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() ));
1367 } 1370 }
1368 mFileString = ""; 1371 mFileString = "";
1369 mFileName = fn; 1372 mFileName = fn;
1370 mFirst = true; 1373 mFirst = true;
1371 if ( tlw ) 1374 if ( tlw )
1372 tlw->setCaption( i18n("Trying to connect to remote...") ); 1375 tlw->setCaption( i18n("Trying to connect to remote...") );
1373 mSocket->connectToHost( mHost, mPort ); 1376 mSocket->connectToHost( mHost, mPort );
1374 qDebug("KSS: Waiting for connection"); 1377 qDebug("KSS: Waiting for connection");
1375 mTimerSocket->start( 20000 ); 1378 mTimerSocket->start( 20000 );
1376} 1379}
1377 1380
1378void KCommandSocket::writeFile( QString fileName ) 1381void KCommandSocket::writeFile( QString fileName )
1379{ 1382{
1380 if ( !mSocket ) { 1383 if ( !mSocket ) {
1381 mSocket = new QSocket( this ); 1384 mSocket = new QSocket( this );
1382 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1385 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1383 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); 1386 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
1384 } 1387 }
1385 mFileName = fileName ; 1388 mFileName = fileName ;
1386 mSocket->connectToHost( mHost, mPort ); 1389 mSocket->connectToHost( mHost, mPort );
1387} 1390}
1388void KCommandSocket::writeFileToSocket() 1391void KCommandSocket::writeFileToSocket()
1389{ 1392{
1390 QFile file2( mFileName ); 1393 QFile file2( mFileName );
1391 if (!file2.open( IO_ReadOnly ) ) { 1394 if (!file2.open( IO_ReadOnly ) ) {
1392 mRetVal= errorW; 1395 mRetVal= errorW;
1393 mSocket->close(); 1396 mSocket->close();
1394 if ( mSocket->state() == QSocket::Idle ) 1397 if ( mSocket->state() == QSocket::Idle )
1395 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1398 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1396 return ; 1399 return ;
1397 } 1400 }
1398 QTextStream ts2( &file2 ); 1401 QTextStream ts2( &file2 );
1399 ts2.setEncoding( QTextStream::Latin1 ); 1402 ts2.setEncoding( QTextStream::Latin1 );
1400 QTextStream os2( mSocket ); 1403 QTextStream os2( mSocket );
1401 os2.setEncoding( QTextStream::Latin1 ); 1404 os2.setEncoding( QTextStream::Latin1 );
1402 os2 << "PUT " << mPassWord << "\r\n\r\n";; 1405 os2 << "PUT " << mPassWord << "\r\n\r\n";;
1403 while ( ! ts2.atEnd() ) { 1406 while ( ! ts2.atEnd() ) {
1404 os2 << ts2.readLine() << "\r\n\r\n"; 1407 os2 << ts2.readLine() << "\r\n\r\n";
1405 } 1408 }
1406 mRetVal= successW; 1409 mRetVal= successW;
1407 file2.close(); 1410 file2.close();
1408 mSocket->close(); 1411 mSocket->close();
1409 if ( mSocket->state() == QSocket::Idle ) 1412 if ( mSocket->state() == QSocket::Idle )
1410 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1413 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1411} 1414}
1412void KCommandSocket::sendStop() 1415void KCommandSocket::sendStop()
1413{ 1416{
1414 if ( !mSocket ) { 1417 if ( !mSocket ) {
1415 mSocket = new QSocket( this ); 1418 mSocket = new QSocket( this );
1416 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1419 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1417 } 1420 }
1418 mSocket->connectToHost( mHost, mPort ); 1421 mSocket->connectToHost( mHost, mPort );
1419 QTextStream os2( mSocket ); 1422 QTextStream os2( mSocket );
1420 os2.setEncoding( QTextStream::Latin1 ); 1423 os2.setEncoding( QTextStream::Latin1 );
1421 os2 << "STOP\r\n\r\n"; 1424 os2 << "STOP\r\n\r\n";
1422 mSocket->close(); 1425 mSocket->close();
1423 if ( mSocket->state() == QSocket::Idle ) 1426 if ( mSocket->state() == QSocket::Idle )
1424 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1427 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1425} 1428}
1426 1429
1427void KCommandSocket::startReadFileFromSocket() 1430void KCommandSocket::startReadFileFromSocket()
1428{ 1431{
1429 if ( ! mFirst ) 1432 if ( ! mFirst )
1430 return; 1433 return;
1431 mFirst = false; 1434 mFirst = false;
1432 mTimerSocket->stop(); 1435 mTimerSocket->stop();
1433 mFileString = ""; 1436 mFileString = "";
1434 mTime.start(); 1437 mTime.start();
1435 QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); 1438 QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) ));
1436 1439
1437} 1440}
1438void KCommandSocket::readFileFromSocket() 1441void KCommandSocket::readFileFromSocket()
1439{ 1442{
1440 //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); 1443 //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
1441 while ( mSocket->canReadLine () ) { 1444 while ( mSocket->canReadLine () ) {
1442 mTime.restart(); 1445 mTime.restart();
1443 QString line = mSocket->readLine (); 1446 QString line = mSocket->readLine ();
1444 mFileString += line; 1447 mFileString += line;
1445 //qDebug("readline: %s ", line.latin1()); 1448 //qDebug("readline: %s ", line.latin1());
1446 } 1449 }
1447 if ( mTime.elapsed () < 3000 ) { 1450 if ( mTime.elapsed () < 3000 ) {
1448 // wait for more 1451 // wait for more
1449 //qDebug("waitformore "); 1452 //qDebug("waitformore ");
1450 QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); 1453 QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) ));
1451 return; 1454 return;
1452 } 1455 }
1453 QString fileName = mFileName; 1456 QString fileName = mFileName;
1454 QFile file ( fileName ); 1457 QFile file ( fileName );
1455 if (!file.open( IO_WriteOnly ) ) { 1458 if (!file.open( IO_WriteOnly ) ) {
1456 mFileString = ""; 1459 mFileString = "";
1457 mRetVal = errorR; 1460 mRetVal = errorR;
1458 qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() ); 1461 qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() );
1459 deleteSocket(); 1462 deleteSocket();
1460 return ; 1463 return ;
1461 1464
1462 } 1465 }
1463 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1466 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1464 QTextStream ts ( &file ); 1467 QTextStream ts ( &file );
1465 ts.setEncoding( QTextStream::Latin1 ); 1468 ts.setEncoding( QTextStream::Latin1 );
1466 ts << mFileString; 1469 ts << mFileString;
1467 file.close(); 1470 file.close();
1468 mFileString = ""; 1471 mFileString = "";
1469 mRetVal = successR; 1472 mRetVal = successR;
1470 mSocket->close(); 1473 mSocket->close();
1471 // if state is not idle, deleteSocket(); is called via 1474 // if state is not idle, deleteSocket(); is called via
1472 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1475 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1473 if ( mSocket->state() == QSocket::Idle ) 1476 if ( mSocket->state() == QSocket::Idle )
1474 deleteSocket(); 1477 deleteSocket();
1475} 1478}
1476 1479
1477void KCommandSocket::deleteSocket() 1480void KCommandSocket::deleteSocket()
1478{ 1481{
1479 //qDebug("KCommandSocket::deleteSocket() "); 1482 //qDebug("KCommandSocket::deleteSocket() ");
1480 if ( mTimerSocket->isActive () ) { 1483 if ( mTimerSocket->isActive () ) {
1481 mTimerSocket->stop(); 1484 mTimerSocket->stop();
1482 mRetVal = errorTO; 1485 mRetVal = errorTO;
1483 qDebug("KCS::Connection to remote host timed out"); 1486 qDebug("KCS::Connection to remote host timed out");
1484 if ( mSocket ) { 1487 if ( mSocket ) {
1485 mSocket->close(); 1488 mSocket->close();
1486 //if ( mSocket->state() == QSocket::Idle ) 1489 //if ( mSocket->state() == QSocket::Idle )
1487 // deleteSocket(); 1490 // deleteSocket();
1488 delete mSocket; 1491 delete mSocket;
1489 mSocket = 0; 1492 mSocket = 0;
1490 } 1493 }
1491 KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?")); 1494 KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?"));
1492 emit commandFinished( this, mRetVal ); 1495 emit commandFinished( this, mRetVal );
1493 return; 1496 return;
1494 } 1497 }
1495 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); 1498 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
1496 if ( mSocket) 1499 if ( mSocket)
1497 delete mSocket; 1500 delete mSocket;
1498 mSocket = 0; 1501 mSocket = 0;
1499 emit commandFinished( this, mRetVal ); 1502 emit commandFinished( this, mRetVal );
1500} 1503}
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 9a3066e..09bd1c1 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -1,225 +1,225 @@
1/* 1/*
2 This file is part of KDE-Pim/Pi. 2 This file is part of KDE-Pim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 19
20 $Id$ 20 $Id$
21*/ 21*/
22#ifndef _KSYNCMANAGER_H 22#ifndef _KSYNCMANAGER_H
23#define _KSYNCMANAGER_H 23#define _KSYNCMANAGER_H
24 24
25#include <qobject.h> 25#include <qobject.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qsocket.h> 27#include <qsocket.h>
28#include <qdatetime.h> 28#include <qdatetime.h>
29#include <qserversocket.h> 29#include <qserversocket.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qregexp.h> 31#include <qregexp.h>
32 32
33class QPopupMenu; 33class QPopupMenu;
34class KSyncProfile; 34class KSyncProfile;
35class KPimPrefs; 35class KPimPrefs;
36class QWidget; 36class QWidget;
37class KSyncManager; 37class KSyncManager;
38class KSyncInterface; 38class KSyncInterface;
39class QProgressBar; 39class QProgressBar;
40 40
41 41
42class KServerSocket : public QServerSocket 42class KServerSocket : public QServerSocket
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 45
46 public: 46 public:
47 KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); 47 KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 );
48 48
49 void newConnection ( int socket ) ; 49 void newConnection ( int socket ) ;
50 void setFileName( QString fn ) {mFileName = fn;}; 50 void setFileName( QString fn ) {mFileName = fn;};
51 signals: 51 signals:
52 void file_received( bool ); 52 void file_received( bool );
53 void request_file(); 53 void request_file();
54 void saveFile(); 54 void saveFile();
55 void endConnect(); 55 void endConnect();
56 private slots: 56 private slots:
57 void discardClient(); 57 void discardClient();
58 void readClient(); 58 void readClient();
59 void readBackFileFromSocket(); 59 void readBackFileFromSocket();
60 private : 60 private :
61 bool blockRC; 61 bool blockRC;
62 void send_file(); 62 void send_file();
63 void get_file(); 63 void get_file();
64 void end_connect(); 64 void end_connect();
65 QDialog* mSyncActionDialog; 65 QDialog* mSyncActionDialog;
66 QSocket* mSocket; 66 QSocket* mSocket;
67 QString mPassWord; 67 QString mPassWord;
68 QString mFileName; 68 QString mFileName;
69 QTime piTime; 69 QTime piTime;
70 QString piFileString; 70 QString piFileString;
71}; 71};
72 72
73class KCommandSocket : public QObject 73class KCommandSocket : public QObject
74{ 74{
75 Q_OBJECT 75 Q_OBJECT
76 public: 76 public:
77 enum state { successR, errorR, successW, errorW, errorTO, quiet }; 77 enum state { successR, errorR, successW, errorW, errorTO, quiet };
78 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); 78 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 );
79 void readFile( QString ); 79 void readFile( QString );
80 void writeFile( QString ); 80 void writeFile( QString );
81 void sendStop(); 81 void sendStop();
82 82
83 private slots : 83 private slots :
84 void sendFileRequest(); 84 void sendFileRequest();
85 85
86 signals: 86 signals:
87 void commandFinished( KCommandSocket*, int ); 87 void commandFinished( KCommandSocket*, int );
88 private slots: 88 private slots:
89 void startReadFileFromSocket(); 89 void startReadFileFromSocket();
90 void readFileFromSocket(); 90 void readFileFromSocket();
91 void deleteSocket(); 91 void deleteSocket();
92 void writeFileToSocket(); 92 void writeFileToSocket();
93 private : 93 private :
94 QWidget* tlw; 94 QWidget* tlw;
95 QSocket* mSocket; 95 QSocket* mSocket;
96 QString mPassWord; 96 QString mPassWord;
97 Q_UINT16 mPort; 97 Q_UINT16 mPort;
98 QString mHost; 98 QString mHost;
99 QString mFileName; 99 QString mFileName;
100 QTimer* mTimerSocket; 100 QTimer* mTimerSocket;
101 int mRetVal; 101 int mRetVal;
102 QTime mTime; 102 QTime mTime;
103 QString mFileString; 103 QString mFileString;
104 bool mFirst; 104 bool mFirst;
105}; 105};
106 106
107 107
108class KSyncManager : public QObject 108class KSyncManager : public QObject
109{ 109{
110 Q_OBJECT 110 Q_OBJECT
111 111
112 public: 112 public:
113 enum TargetApp { 113 enum TargetApp {
114 KOPI = 0, 114 KOPI = 0,
115 KAPI = 1, 115 KAPI = 1,
116 PWMPI = 2 }; 116 PWMPI = 2 };
117 117
118 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); 118 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
119 ~KSyncManager() ; 119 ~KSyncManager() ;
120 120
121 void multiSync( bool askforPrefs ); 121 void multiSync( bool askforPrefs );
122 bool blockSave() { return mBlockSaveFlag; } 122 bool blockSave() { return mBlockSaveFlag; }
123 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 123 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
124 void setDefaultFileName( QString s) { mDefFileName = s ;} 124 void setDefaultFileName( QString s) ;
125 QString defaultFileName() { return mDefFileName ;} 125 QString defaultFileName() { return mDefFileName ;}
126 QString syncFileName(); 126 QString syncFileName();
127 void enableQuick( bool ask = true); 127 void enableQuick( bool ask = true);
128 128
129 bool syncWithDesktop () { return mSyncWithDesktop;} 129 bool syncWithDesktop () { return mSyncWithDesktop;}
130 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 130 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
131 QString getCurrentSyncName() { return mCurrentSyncName; } 131 QString getCurrentSyncName() { return mCurrentSyncName; }
132 132
133 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 133 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
134 void hideProgressBar(); 134 void hideProgressBar();
135 bool isProgressBarCanceled(); 135 bool isProgressBarCanceled();
136 136
137 // sync stuff 137 // sync stuff
138 QString mLocalMachineName; 138 QString mLocalMachineName;
139 QStringList mExternSyncProfiles; 139 QStringList mExternSyncProfiles;
140 QStringList mSyncProfileNames; 140 QStringList mSyncProfileNames;
141 bool mAskForPreferences; 141 bool mAskForPreferences;
142 bool mShowSyncSummary; 142 bool mShowSyncSummary;
143 bool mIsKapiFile; 143 bool mIsKapiFile;
144 bool mWriteBackExistingOnly; 144 bool mWriteBackExistingOnly;
145 int mSyncAlgoPrefs; 145 int mSyncAlgoPrefs;
146 bool mWriteBackFile; 146 bool mWriteBackFile;
147 int mWriteBackInFuture; 147 int mWriteBackInFuture;
148 int mWriteBackInPast; 148 int mWriteBackInPast;
149 QString mPhoneDevice; 149 QString mPhoneDevice;
150 QString mPhoneConnection; 150 QString mPhoneConnection;
151 QString mPhoneModel; 151 QString mPhoneModel;
152 QString mPassWordPiSync; 152 QString mPassWordPiSync;
153 QString mActiveSyncPort; 153 QString mActiveSyncPort;
154 QString mActiveSyncIP ; 154 QString mActiveSyncIP ;
155 QString mFilterInCal; 155 QString mFilterInCal;
156 QString mFilterOutCal; 156 QString mFilterOutCal;
157 QString mFilterInAB; 157 QString mFilterInAB;
158 QString mFilterOutAB; 158 QString mFilterOutAB;
159 static QDateTime mRequestedSyncEvent; 159 static QDateTime mRequestedSyncEvent;
160 160
161 signals: 161 signals:
162 void save(); 162 void save();
163 void request_file(); 163 void request_file();
164 void getFile( bool ); 164 void getFile( bool );
165 165
166 public slots: 166 public slots:
167 void slotSyncMenu( int ); 167 void slotSyncMenu( int );
168 void slotClearMenu( int action ); 168 void slotClearMenu( int action );
169 void deleteCommandSocket(KCommandSocket*s, int state); 169 void deleteCommandSocket(KCommandSocket*s, int state);
170 void readFileFromSocket(); 170 void readFileFromSocket();
171 void fillSyncMenu(); 171 void fillSyncMenu();
172 172
173 private: 173 private:
174 void syncPi(); 174 void syncPi();
175 KServerSocket * mServerSocket; 175 KServerSocket * mServerSocket;
176 KPimPrefs* mPrefs; 176 KPimPrefs* mPrefs;
177 QString mDefFileName; 177 QString mDefFileName;
178 QString mCurrentSyncDevice; 178 QString mCurrentSyncDevice;
179 QString mCurrentSyncName; 179 QString mCurrentSyncName;
180 void quickSyncLocalFile(); 180 void quickSyncLocalFile();
181 bool syncWithFile( QString fn , bool quick ); 181 bool syncWithFile( QString fn , bool quick );
182 void syncLocalFile(); 182 void syncLocalFile();
183 void syncPhone(); 183 void syncPhone();
184 void syncSharp(); 184 void syncSharp();
185 void syncKDE(); 185 void syncKDE();
186 bool syncExternalApplication(QString); 186 bool syncExternalApplication(QString);
187 int mCurrentSyncProfile ; 187 int mCurrentSyncProfile ;
188 void syncRemote( KSyncProfile* prof, bool ask = true); 188 void syncRemote( KSyncProfile* prof, bool ask = true);
189 bool edit_sync_options(); 189 bool edit_sync_options();
190 bool edit_pisync_options(); 190 bool edit_pisync_options();
191 int ringSync(); 191 int ringSync();
192 QString getPassword( ); 192 QString getPassword( );
193 bool mPisyncFinished; 193 bool mPisyncFinished;
194 bool mBlockSaveFlag; 194 bool mBlockSaveFlag;
195 QWidget* mParent; 195 QWidget* mParent;
196 KSyncInterface* mImplementation; 196 KSyncInterface* mImplementation;
197 TargetApp mTargetApp; 197 TargetApp mTargetApp;
198 QPopupMenu* mSyncMenu; 198 QPopupMenu* mSyncMenu;
199 QProgressBar* bar; 199 QProgressBar* bar;
200 bool mSyncWithDesktop; 200 bool mSyncWithDesktop;
201 201
202private slots: 202private slots:
203 void confSync(); 203 void confSync();
204 204
205 205
206}; 206};
207 207
208 208
209class KSyncInterface 209class KSyncInterface
210{ 210{
211 public : 211 public :
212 virtual void removeSyncInfo( QString syncProfile) = 0; 212 virtual void removeSyncInfo( QString syncProfile) = 0;
213 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; 213 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0;
214 virtual bool syncExternal(KSyncManager* manager, QString resource) 214 virtual bool syncExternal(KSyncManager* manager, QString resource)
215 { 215 {
216 // empty implementation, because some syncable applications do not 216 // empty implementation, because some syncable applications do not
217 // have an external(sharpdtm) syncmode, like pwmanager. 217 // have an external(sharpdtm) syncmode, like pwmanager.
218 return false; 218 return false;
219 } 219 }
220 220
221 221
222}; 222};
223 223
224 224
225#endif 225#endif