-rw-r--r-- | bin/kdepim/WhatsNew.txt | 6 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 34 |
2 files changed, 23 insertions, 17 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 8fab725..2ce78c7 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,213 +1,217 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.1.14 ************ | 3 | ********** VERSION 2.1.14 ************ |
4 | 4 | ||
5 | Added some buttons to the KO/Pi Quick-todo line to make it possible to quickly access some todo view layout settings like display all flat/open/close and hide/show running/done. | 5 | Added some buttons to the KO/Pi Quick-todo line to make it possible to quickly access some todo view layout settings like display all flat/open/close and hide/show running/done. |
6 | Added a button to add a subtodo quickly. | 6 | Added a button to add a subtodo quickly. |
7 | 7 | ||
8 | Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ). | 8 | Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ). |
9 | Added an option to change the layout of the list week to column mode. | 9 | Added an option to change the layout of the list week to column mode. |
10 | 10 | ||
11 | Fixed some usability problems in pi-sync mode by adding some progress information about file transfer. | 11 | Fixed some usability problems in pi-sync mode by adding some progress information about file transfer. |
12 | 12 | ||
13 | Fixed pi-sync problems with the new multi calendar feature. | 13 | Fixed pi-sync problems with the new multi calendar feature. |
14 | Now pi-sync behaviour should be: | 14 | Now pi-sync behaviour should be: |
15 | 1) Local sends file request ( as usual ) | 15 | 1) Local sends file request ( as usual ) |
16 | 2) Remote sends file which contains data of all enabled ( the calendar where the "eye" column is checked ) calendars. | 16 | 2) Remote sends file which contains data of all enabled ( the calendar where the "eye" column is checked ) calendars. |
17 | 3) Local syncs with data, adds new entries to default calendar and sends file back ( as usual ). | 17 | 3) Local syncs with data, adds new entries to default calendar and sends file back ( as usual ). |
18 | If the data which local receives contains entries which are on disabled calendars on local this entries are updated and not added as duplicates to the default calendar. | ||
18 | 4) Remote updates the data and adds new entries to default calendar. Readonly entries are not changed on remote. | 19 | 4) Remote updates the data and adds new entries to default calendar. Readonly entries are not changed on remote. |
19 | If the data which remote receives contains entries which are on disabled calendars on remote this entries are updated and not added as duplicates to the default calendar. | 20 | If the data which remote receives contains entries which are on disabled calendars on remote this entries are updated and not added as duplicates to the default calendar. |
20 | 21 | ||
21 | Summary: If you have different calendars on remote and local and some of them disabled you may get some "strange" bahaviour. | 22 | Summary: |
23 | No new item ( new created after the last sync ) in a disabled calendar is propagated to the sync partner. Readonly items are synced and added/changed on the sync partner if it is not readonly on the sync partner. | ||
24 | If you have different calendars on remote and local and some of them disabled you may get some "strange" bahaviour. | ||
25 | Well, the syncing has become quite complicated ... you should have no problems if you enable all calendars. | ||
22 | 26 | ||
23 | ********** VERSION 2.1.13 ************ | 27 | ********** VERSION 2.1.13 ************ |
24 | 28 | ||
25 | Fixed a problem in KA/Pi search. | 29 | Fixed a problem in KA/Pi search. |
26 | Fixed some minor problems in KO/Pi. | 30 | Fixed some minor problems in KO/Pi. |
27 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. | 31 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. |
28 | 32 | ||
29 | Fixed memory usage problems in KA/Pi: | 33 | Fixed memory usage problems in KA/Pi: |
30 | When loading data KA/Pi did load the file data twice. | 34 | When loading data KA/Pi did load the file data twice. |
31 | Example: | 35 | Example: |
32 | A 600k file did consume 1200k memory during loading process. | 36 | A 600k file did consume 1200k memory during loading process. |
33 | This is fixed, it does now consume only 600k during loading process. | 37 | This is fixed, it does now consume only 600k during loading process. |
34 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. | 38 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. |
35 | This is fixed. | 39 | This is fixed. |
36 | Example: | 40 | Example: |
37 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. | 41 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. |
38 | When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. | 42 | When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. |
39 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. | 43 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. |
40 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. | 44 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. |
41 | The saving of data may be a bit slower now. | 45 | The saving of data may be a bit slower now. |
42 | 46 | ||
43 | Fixed memory usage problems in KO/Pi: | 47 | Fixed memory usage problems in KO/Pi: |
44 | When KO/Pi did save the data to file, it did not release the used buffers after saving. | 48 | When KO/Pi did save the data to file, it did not release the used buffers after saving. |
45 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. | 49 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. |
46 | This is fixed. | 50 | This is fixed. |
47 | Example: | 51 | Example: |
48 | When saving a 400k file KO/Pi do now use 400k less memory now. | 52 | When saving a 400k file KO/Pi do now use 400k less memory now. |
49 | 53 | ||
50 | Optimized memory usage in KO/Pi Agenda view: | 54 | Optimized memory usage in KO/Pi Agenda view: |
51 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. | 55 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. |
52 | These buffers were not made smaller (i.e. downsized) because of performance reasons. | 56 | These buffers were not made smaller (i.e. downsized) because of performance reasons. |
53 | The handling of these buffers are now much smarter: | 57 | The handling of these buffers are now much smarter: |
54 | Two (of six) buffers are removed completely. | 58 | Two (of six) buffers are removed completely. |
55 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. | 59 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. |
56 | Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi. | 60 | Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi. |
57 | 61 | ||
58 | Worst case example ( for a maximum size agenda content): | 62 | Worst case example ( for a maximum size agenda content): |
59 | When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem. | 63 | When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem. |
60 | 64 | ||
61 | When switching to an unused Agenda view now KO/Pi is upizing the buffers again. This takes less than a second. Such that switching to Agenda view (after not using it for more than 45 seconds) is now a bit slower. | 65 | When switching to an unused Agenda view now KO/Pi is upizing the buffers again. This takes less than a second. Such that switching to Agenda view (after not using it for more than 45 seconds) is now a bit slower. |
62 | 66 | ||
63 | Summary: | 67 | Summary: |
64 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. | 68 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. |
65 | 69 | ||
66 | ********** VERSION 2.1.12 ************ | 70 | ********** VERSION 2.1.12 ************ |
67 | 71 | ||
68 | KO/Pi: | 72 | KO/Pi: |
69 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. | 73 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. |
70 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. | 74 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. |
71 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). | 75 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). |
72 | Fixed some other small problems. | 76 | Fixed some other small problems. |
73 | 77 | ||
74 | ********** VERSION 2.1.11 ************ | 78 | ********** VERSION 2.1.11 ************ |
75 | 79 | ||
76 | KO/Pi: | 80 | KO/Pi: |
77 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. | 81 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. |
78 | Added features to handle (and add ) more than one journal entry per day. | 82 | Added features to handle (and add ) more than one journal entry per day. |
79 | Added option for a journal title. | 83 | Added option for a journal title. |
80 | 84 | ||
81 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. | 85 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. |
82 | Fixed a problem of the alarm of completed recurring todos. | 86 | Fixed a problem of the alarm of completed recurring todos. |
83 | Added to the event/todo editor to set quickly the category of an item. | 87 | Added to the event/todo editor to set quickly the category of an item. |
84 | 88 | ||
85 | 89 | ||
86 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. | 90 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. |
87 | 91 | ||
88 | Added KA/Pi multi sync to the multi sync called from the alarm applet. | 92 | Added KA/Pi multi sync to the multi sync called from the alarm applet. |
89 | 93 | ||
90 | ********** VERSION 2.1.10 ************ | 94 | ********** VERSION 2.1.10 ************ |
91 | 95 | ||
92 | KO/Pi: | 96 | KO/Pi: |
93 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. | 97 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. |
94 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. | 98 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. |
95 | Fixed a bug in searching for a small timerange, i.e. one day. | 99 | Fixed a bug in searching for a small timerange, i.e. one day. |
96 | 100 | ||
97 | KA/Pi: | 101 | KA/Pi: |
98 | Fixed two problems in csv export. | 102 | Fixed two problems in csv export. |
99 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. | 103 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. |
100 | 104 | ||
101 | ********** VERSION 2.1.9 ************ | 105 | ********** VERSION 2.1.9 ************ |
102 | 106 | ||
103 | KO/Pi: | 107 | KO/Pi: |
104 | Fixed some problems of the new search options in the search dialog. | 108 | Fixed some problems of the new search options in the search dialog. |
105 | Fixed some problems in the new resource config options. | 109 | Fixed some problems in the new resource config options. |
106 | Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. | 110 | Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. |
107 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: | 111 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: |
108 | Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. | 112 | Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. |
109 | 113 | ||
110 | Fixed a problem in recurrence range in syncing with DTM. | 114 | Fixed a problem in recurrence range in syncing with DTM. |
111 | 115 | ||
112 | KA/Pi: | 116 | KA/Pi: |
113 | Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) | 117 | Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) |
114 | 118 | ||
115 | PwM/Pi: | 119 | PwM/Pi: |
116 | Added "sec" to the timeout config settings to make it clear the timeout values are seconds. | 120 | Added "sec" to the timeout config settings to make it clear the timeout values are seconds. |
117 | 121 | ||
118 | ********** VERSION 2.1.8 ************ | 122 | ********** VERSION 2.1.8 ************ |
119 | 123 | ||
120 | KO/Pi: | 124 | KO/Pi: |
121 | Added info about the completion state of a todo in the ListView/Searchdialog. | 125 | Added info about the completion state of a todo in the ListView/Searchdialog. |
122 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. | 126 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. |
123 | Fixed some updating problems when changing the filter. | 127 | Fixed some updating problems when changing the filter. |
124 | 128 | ||
125 | KA/Pi: | 129 | KA/Pi: |
126 | In the addressee selection dialog now the formatted name is shown, if not empty. | 130 | In the addressee selection dialog now the formatted name is shown, if not empty. |
127 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. | 131 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. |
128 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. | 132 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. |
129 | 133 | ||
130 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. | 134 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. |
131 | Fixed the sorting for size in the file selector on the Z. | 135 | Fixed the sorting for size in the file selector on the Z. |
132 | 136 | ||
133 | Changed the color selection dialog on the Zaurus to a more user friendly version. | 137 | Changed the color selection dialog on the Zaurus to a more user friendly version. |
134 | 138 | ||
135 | ********** VERSION 2.1.7 ************ | 139 | ********** VERSION 2.1.7 ************ |
136 | 140 | ||
137 | KO/Pi: | 141 | KO/Pi: |
138 | Fixed several problems in the new Resource handling. | 142 | Fixed several problems in the new Resource handling. |
139 | Added more options to the search dialog. | 143 | Added more options to the search dialog. |
140 | Fixed a problem in the Month view. | 144 | Fixed a problem in the Month view. |
141 | Added more options to the dialog when setting a todo to stopped. | 145 | Added more options to the dialog when setting a todo to stopped. |
142 | 146 | ||
143 | Fixed two small problems in KO/Pi Alarm applet. | 147 | Fixed two small problems in KO/Pi Alarm applet. |
144 | 148 | ||
145 | ********** VERSION 2.1.6 ************ | 149 | ********** VERSION 2.1.6 ************ |
146 | 150 | ||
147 | This release is for testing only. | 151 | This release is for testing only. |
148 | 152 | ||
149 | KO/Pi: | 153 | KO/Pi: |
150 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. | 154 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. |
151 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. | 155 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. |
152 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. | 156 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. |
153 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. | 157 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. |
154 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. | 158 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. |
155 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. | 159 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. |
156 | 160 | ||
157 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. | 161 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. |
158 | In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. | 162 | In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. |
159 | Now on every sync the set of calendars is synced which are enabled in the resource view. | 163 | Now on every sync the set of calendars is synced which are enabled in the resource view. |
160 | 164 | ||
161 | A calendar is enabled in the resource view if the "eye" column is checked. | 165 | A calendar is enabled in the resource view if the "eye" column is checked. |
162 | You can set a calendar to be the default for new items( "+" column ). | 166 | You can set a calendar to be the default for new items( "+" column ). |
163 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. | 167 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. |
164 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... | 168 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... |
165 | 169 | ||
166 | 170 | ||
167 | ********** VERSION 2.1.5 ************ | 171 | ********** VERSION 2.1.5 ************ |
168 | 172 | ||
169 | This is the new stable version. | 173 | This is the new stable version. |
170 | Bugfix: | 174 | Bugfix: |
171 | Fixed a problem with agenda popup on the desktop in KO/Pi. | 175 | Fixed a problem with agenda popup on the desktop in KO/Pi. |
172 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. | 176 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. |
173 | Added config option to not display completed todos in agenda view. | 177 | Added config option to not display completed todos in agenda view. |
174 | Addressee view is now using the formatted name, if defined. | 178 | Addressee view is now using the formatted name, if defined. |
175 | That makes it possible to display "lastname, firstname" in that view now. | 179 | That makes it possible to display "lastname, firstname" in that view now. |
176 | To set the formatted name for all contacts, please use menu: | 180 | To set the formatted name for all contacts, please use menu: |
177 | Edit->Change->Set formatted name. | 181 | Edit->Change->Set formatted name. |
178 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. | 182 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. |
179 | 183 | ||
180 | ********** VERSION 2.1.4 ************ | 184 | ********** VERSION 2.1.4 ************ |
181 | 185 | ||
182 | Fixed two more bugs in the KA/Pi CSV import dialog: | 186 | Fixed two more bugs in the KA/Pi CSV import dialog: |
183 | Made it possible to read multi-line fields and import it to the "Note" field. | 187 | Made it possible to read multi-line fields and import it to the "Note" field. |
184 | Fixed a problem in mapping custom fields, whatever a custem field is... | 188 | Fixed a problem in mapping custom fields, whatever a custem field is... |
185 | 189 | ||
186 | ********** VERSION 2.1.3 ************ | 190 | ********** VERSION 2.1.3 ************ |
187 | 191 | ||
188 | Changed the menu structure of the alarm applet: | 192 | Changed the menu structure of the alarm applet: |
189 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". | 193 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". |
190 | 194 | ||
191 | Fixed several problems in the KA/Pi CSV import dialog: | 195 | Fixed several problems in the KA/Pi CSV import dialog: |
192 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. | 196 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. |
193 | 197 | ||
194 | 198 | ||
195 | ********** VERSION 2.1.2 ************ | 199 | ********** VERSION 2.1.2 ************ |
196 | 200 | ||
197 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. | 201 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. |
198 | 202 | ||
199 | Fixed a problem when importing data from Outlook with mutiple categories set. | 203 | Fixed a problem when importing data from Outlook with mutiple categories set. |
200 | 204 | ||
201 | Changed display of days in datenavigator: | 205 | Changed display of days in datenavigator: |
202 | Birthdays are now blue, not dark green. | 206 | Birthdays are now blue, not dark green. |
203 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. | 207 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. |
204 | When journal view is shown, only holidays are shown and days with journals are blue. | 208 | When journal view is shown, only holidays are shown and days with journals are blue. |
205 | 209 | ||
206 | Added Backup options to global config: | 210 | Added Backup options to global config: |
207 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). | 211 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). |
208 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. | 212 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. |
209 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. | 213 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. |
210 | 214 | ||
211 | ********** VERSION 2.1.1 ************ | 215 | ********** VERSION 2.1.1 ************ |
212 | 216 | ||
213 | Stable release 2.1.1! | 217 | Stable release 2.1.1! |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a350c3b..7044e90 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1252,493 +1252,495 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
1252 | 1252 | ||
1253 | break; | 1253 | break; |
1254 | case SYNC_PREF_FORCE_LOCAL: | 1254 | case SYNC_PREF_FORCE_LOCAL: |
1255 | return 1; | 1255 | return 1; |
1256 | break; | 1256 | break; |
1257 | case SYNC_PREF_FORCE_REMOTE: | 1257 | case SYNC_PREF_FORCE_REMOTE: |
1258 | return 2; | 1258 | return 2; |
1259 | break; | 1259 | break; |
1260 | 1260 | ||
1261 | default: | 1261 | default: |
1262 | // SYNC_PREF_TAKE_BOTH not implemented | 1262 | // SYNC_PREF_TAKE_BOTH not implemented |
1263 | break; | 1263 | break; |
1264 | } | 1264 | } |
1265 | return 0; | 1265 | return 0; |
1266 | } | 1266 | } |
1267 | Event* CalendarView::getLastSyncEvent() | 1267 | Event* CalendarView::getLastSyncEvent() |
1268 | { | 1268 | { |
1269 | Event* lse; | 1269 | Event* lse; |
1270 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 1270 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
1271 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 1271 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
1272 | if (!lse) { | 1272 | if (!lse) { |
1273 | lse = new Event(); | 1273 | lse = new Event(); |
1274 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 1274 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
1275 | QString sum = ""; | 1275 | QString sum = ""; |
1276 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 1276 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
1277 | sum = "E: "; | 1277 | sum = "E: "; |
1278 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 1278 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
1279 | lse->setDtStart( mLastCalendarSync ); | 1279 | lse->setDtStart( mLastCalendarSync ); |
1280 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1280 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1281 | lse->setCategories( i18n("SyncEvent") ); | 1281 | lse->setCategories( i18n("SyncEvent") ); |
1282 | lse->setReadOnly( true ); | 1282 | lse->setReadOnly( true ); |
1283 | mCalendar->addEvent( lse ); | 1283 | mCalendar->addEvent( lse ); |
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | return lse; | 1286 | return lse; |
1287 | 1287 | ||
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | // we check, if the to delete event has a id for a profile | 1290 | // we check, if the to delete event has a id for a profile |
1291 | // if yes, we set this id in the profile to delete | 1291 | // if yes, we set this id in the profile to delete |
1292 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 1292 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
1293 | { | 1293 | { |
1294 | if ( lastSync.count() == 0 ) { | 1294 | if ( lastSync.count() == 0 ) { |
1295 | //qDebug(" lastSync.count() == 0"); | 1295 | //qDebug(" lastSync.count() == 0"); |
1296 | return; | 1296 | return; |
1297 | } | 1297 | } |
1298 | if ( toDelete->typeID() == journalID ) | 1298 | if ( toDelete->typeID() == journalID ) |
1299 | return; | 1299 | return; |
1300 | 1300 | ||
1301 | Event* eve = lastSync.first(); | 1301 | Event* eve = lastSync.first(); |
1302 | 1302 | ||
1303 | while ( eve ) { | 1303 | while ( eve ) { |
1304 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 1304 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
1305 | if ( !id.isEmpty() ) { | 1305 | if ( !id.isEmpty() ) { |
1306 | QString des = eve->description(); | 1306 | QString des = eve->description(); |
1307 | QString pref = "e"; | 1307 | QString pref = "e"; |
1308 | if ( toDelete->typeID() == todoID ) | 1308 | if ( toDelete->typeID() == todoID ) |
1309 | pref = "t"; | 1309 | pref = "t"; |
1310 | des += pref+ id + ","; | 1310 | des += pref+ id + ","; |
1311 | eve->setReadOnly( false ); | 1311 | eve->setReadOnly( false ); |
1312 | eve->setDescription( des ); | 1312 | eve->setDescription( des ); |
1313 | //qDebug("setdes %s ", des.latin1()); | 1313 | //qDebug("setdes %s ", des.latin1()); |
1314 | eve->setReadOnly( true ); | 1314 | eve->setReadOnly( true ); |
1315 | } | 1315 | } |
1316 | eve = lastSync.next(); | 1316 | eve = lastSync.next(); |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | } | 1319 | } |
1320 | void CalendarView::checkExternalId( Incidence * inc ) | 1320 | void CalendarView::checkExternalId( Incidence * inc ) |
1321 | { | 1321 | { |
1322 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 1322 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
1323 | checkExternSyncEvent( lastSync, inc ); | 1323 | checkExternSyncEvent( lastSync, inc ); |
1324 | 1324 | ||
1325 | } | 1325 | } |
1326 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 1326 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
1327 | { | 1327 | { |
1328 | bool syncOK = true; | 1328 | bool syncOK = true; |
1329 | int addedEvent = 0; | 1329 | int addedEvent = 0; |
1330 | int addedEventR = 0; | 1330 | int addedEventR = 0; |
1331 | int deletedEventR = 0; | 1331 | int deletedEventR = 0; |
1332 | int deletedEventL = 0; | 1332 | int deletedEventL = 0; |
1333 | int changedLocal = 0; | 1333 | int changedLocal = 0; |
1334 | int changedRemote = 0; | 1334 | int changedRemote = 0; |
1335 | int filteredIN = 0; | 1335 | int filteredIN = 0; |
1336 | int filteredOUT = 0; | 1336 | int filteredOUT = 0; |
1337 | //QPtrList<Event> el = local->rawEvents(); | 1337 | //QPtrList<Event> el = local->rawEvents(); |
1338 | Event* eventR; | 1338 | Event* eventR; |
1339 | QString uid; | 1339 | QString uid; |
1340 | int take; | 1340 | int take; |
1341 | Event* eventRSync; | 1341 | Event* eventRSync; |
1342 | Event* eventLSync; | 1342 | Event* eventLSync; |
1343 | clearAllViews(); | 1343 | clearAllViews(); |
1344 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 1344 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
1345 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 1345 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
1346 | bool fullDateRange = false; | 1346 | bool fullDateRange = false; |
1347 | local->resetTempSyncStat(); | 1347 | local->resetTempSyncStat(); |
1348 | mLastCalendarSync = QDateTime::currentDateTime(); | 1348 | mLastCalendarSync = QDateTime::currentDateTime(); |
1349 | if ( mSyncManager->syncWithDesktop() ) { | 1349 | if ( mSyncManager->syncWithDesktop() ) { |
1350 | remote->resetPilotStat(1); | 1350 | remote->resetPilotStat(1); |
1351 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1351 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1352 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 1352 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
1353 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 1353 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
1354 | } else { | 1354 | } else { |
1355 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 1355 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
1356 | } | 1356 | } |
1357 | } | 1357 | } |
1358 | QDateTime modifiedCalendar = mLastCalendarSync; | 1358 | QDateTime modifiedCalendar = mLastCalendarSync; |
1359 | eventLSync = getLastSyncEvent(); | 1359 | eventLSync = getLastSyncEvent(); |
1360 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 1360 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
1361 | if ( eventR ) { | 1361 | if ( eventR ) { |
1362 | qDebug("last-syncEvent on remote found "); | 1362 | qDebug("last-syncEvent on remote found "); |
1363 | eventRSync = (Event*) eventR->clone(); | 1363 | eventRSync = (Event*) eventR->clone(); |
1364 | remote->deleteEvent(eventR ); | 1364 | remote->deleteEvent(eventR ); |
1365 | 1365 | ||
1366 | } else { | 1366 | } else { |
1367 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 1367 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
1368 | eventRSync = (Event*)eventLSync->clone(); | 1368 | eventRSync = (Event*)eventLSync->clone(); |
1369 | } else { | 1369 | } else { |
1370 | fullDateRange = true; | 1370 | fullDateRange = true; |
1371 | eventRSync = new Event(); | 1371 | eventRSync = new Event(); |
1372 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 1372 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
1373 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 1373 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
1374 | eventRSync->setDtStart( mLastCalendarSync ); | 1374 | eventRSync->setDtStart( mLastCalendarSync ); |
1375 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1375 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1376 | eventRSync->setCategories( i18n("SyncEvent") ); | 1376 | eventRSync->setCategories( i18n("SyncEvent") ); |
1377 | } | 1377 | } |
1378 | } | 1378 | } |
1379 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 1379 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
1380 | fullDateRange = true; | 1380 | fullDateRange = true; |
1381 | 1381 | ||
1382 | if ( ! fullDateRange ) { | 1382 | if ( ! fullDateRange ) { |
1383 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 1383 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
1384 | 1384 | ||
1385 | qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 1385 | qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
1386 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 1386 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
1387 | fullDateRange = true; | 1387 | fullDateRange = true; |
1388 | } | 1388 | } |
1389 | } | 1389 | } |
1390 | if ( mSyncManager->syncWithDesktop() ) { | 1390 | if ( mSyncManager->syncWithDesktop() ) { |
1391 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 1391 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
1392 | } | 1392 | } |
1393 | if ( fullDateRange ) | 1393 | if ( fullDateRange ) |
1394 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 1394 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
1395 | else | 1395 | else |
1396 | mLastCalendarSync = eventLSync->dtStart(); | 1396 | mLastCalendarSync = eventLSync->dtStart(); |
1397 | // for resyncing if own file has changed | 1397 | // for resyncing if own file has changed |
1398 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 1398 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
1399 | mLastCalendarSync = loadedFileVersion; | 1399 | mLastCalendarSync = loadedFileVersion; |
1400 | //qDebug("setting mLastCalendarSync "); | 1400 | //qDebug("setting mLastCalendarSync "); |
1401 | } | 1401 | } |
1402 | //qDebug("*************************** "); | 1402 | //qDebug("*************************** "); |
1403 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 1403 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
1404 | QPtrList<Incidence> er = remote->rawIncidences(); | 1404 | QPtrList<Incidence> er = remote->rawIncidences(); |
1405 | Incidence* inR = er.first(); | 1405 | Incidence* inR = er.first(); |
1406 | Incidence* inL; | 1406 | Incidence* inL; |
1407 | QProgressBar bar( er.count(),0 ); | 1407 | QProgressBar bar( er.count(),0 ); |
1408 | bar.setCaption (i18n("Syncing - close to abort!") ); | 1408 | bar.setCaption (i18n("Syncing - close to abort!") ); |
1409 | 1409 | ||
1410 | // ************** setting up filter ************* | 1410 | // ************** setting up filter ************* |
1411 | CalFilter *filterIN = 0; | 1411 | CalFilter *filterIN = 0; |
1412 | CalFilter *filterOUT = 0; | 1412 | CalFilter *filterOUT = 0; |
1413 | CalFilter *filter = mFilters.first(); | 1413 | CalFilter *filter = mFilters.first(); |
1414 | while(filter) { | 1414 | while(filter) { |
1415 | if ( filter->name() == mSyncManager->mFilterInCal ) | 1415 | if ( filter->name() == mSyncManager->mFilterInCal ) |
1416 | filterIN = filter; | 1416 | filterIN = filter; |
1417 | if ( filter->name() == mSyncManager->mFilterOutCal ) | 1417 | if ( filter->name() == mSyncManager->mFilterOutCal ) |
1418 | filterOUT = filter; | 1418 | filterOUT = filter; |
1419 | filter = mFilters.next(); | 1419 | filter = mFilters.next(); |
1420 | } | 1420 | } |
1421 | int w = 300; | 1421 | int w = 300; |
1422 | if ( QApplication::desktop()->width() < 320 ) | 1422 | if ( QApplication::desktop()->width() < 320 ) |
1423 | w = 220; | 1423 | w = 220; |
1424 | int h = bar.sizeHint().height() ; | 1424 | int h = bar.sizeHint().height() ; |
1425 | int dw = QApplication::desktop()->width(); | 1425 | int dw = QApplication::desktop()->width(); |
1426 | int dh = QApplication::desktop()->height(); | 1426 | int dh = QApplication::desktop()->height(); |
1427 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1427 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1428 | bar.show(); | 1428 | bar.show(); |
1429 | int modulo = (er.count()/10)+1; | 1429 | int modulo = (er.count()/10)+1; |
1430 | int incCounter = 0; | 1430 | int incCounter = 0; |
1431 | while ( inR ) { | 1431 | while ( inR ) { |
1432 | if ( ! bar.isVisible() ) | 1432 | if ( ! bar.isVisible() ) |
1433 | return false; | 1433 | return false; |
1434 | if ( incCounter % modulo == 0 ) | 1434 | if ( incCounter % modulo == 0 ) |
1435 | bar.setProgress( incCounter ); | 1435 | bar.setProgress( incCounter ); |
1436 | ++incCounter; | 1436 | ++incCounter; |
1437 | uid = inR->uid(); | 1437 | uid = inR->uid(); |
1438 | bool skipIncidence = false; | 1438 | bool skipIncidence = false; |
1439 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1439 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1440 | skipIncidence = true; | 1440 | skipIncidence = true; |
1441 | QString idS; | 1441 | QString idS; |
1442 | qApp->processEvents(); | 1442 | qApp->processEvents(); |
1443 | if ( !skipIncidence ) { | 1443 | if ( !skipIncidence ) { |
1444 | inL = local->incidence( uid ); | 1444 | inL = local->incidenceForUid( uid , false ); |
1445 | if ( inL ) { // maybe conflict - same uid in both calendars | 1445 | if ( inL ) { // maybe conflict - same uid in both calendars |
1446 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1446 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1447 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1447 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1448 | if ( take == 3 ) | 1448 | if ( take == 3 ) |
1449 | return false; | 1449 | return false; |
1450 | if ( take == 1 ) {// take local ********************** | 1450 | if ( take == 1 ) {// take local ********************** |
1451 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1451 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1452 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1452 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1453 | else | 1453 | else |
1454 | idS = inR->IDStr(); | 1454 | idS = inR->IDStr(); |
1455 | int calID = inR->calID(); | 1455 | int calID = inR->calID(); |
1456 | remote->deleteIncidence( inR ); | 1456 | remote->deleteIncidence( inR ); |
1457 | inR = inL->clone(); | 1457 | inR = inL->clone(); |
1458 | inR->setCalID( calID ); | 1458 | inR->setCalID( calID ); |
1459 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1459 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1460 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1460 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1461 | inR->setIDStr( idS ); | 1461 | inR->setIDStr( idS ); |
1462 | remote->addIncidence( inR ); | 1462 | remote->addIncidence( inR ); |
1463 | if ( mSyncManager->syncWithDesktop() ) | 1463 | if ( mSyncManager->syncWithDesktop() ) |
1464 | inR->setPilotId( 2 ); | 1464 | inR->setPilotId( 2 ); |
1465 | ++changedRemote; | 1465 | ++changedRemote; |
1466 | } else {// take remote ********************** | 1466 | } else {// take remote ********************** |
1467 | idS = inL->IDStr(); | 1467 | if ( !inL->isReadOnly() ) { |
1468 | int pid = inL->pilotId(); | 1468 | idS = inL->IDStr(); |
1469 | int calID = inL->calID(); | 1469 | int pid = inL->pilotId(); |
1470 | local->deleteIncidence( inL ); | 1470 | int calID = inL->calID(); |
1471 | inL = inR->clone(); | 1471 | local->deleteIncidence( inL ); |
1472 | inL->setCalID( calID ); | 1472 | inL = inR->clone(); |
1473 | if ( mSyncManager->syncWithDesktop() ) | 1473 | inL->setCalID( calID ); |
1474 | inL->setPilotId( pid ); | 1474 | if ( mSyncManager->syncWithDesktop() ) |
1475 | inL->setIDStr( idS ); | 1475 | inL->setPilotId( pid ); |
1476 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1476 | inL->setIDStr( idS ); |
1477 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1477 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1478 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1478 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1479 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | ||
1480 | } | ||
1481 | local->addIncidence( inL ); | ||
1482 | ++changedLocal; | ||
1479 | } | 1483 | } |
1480 | local->addIncidence( inL ); | ||
1481 | ++changedLocal; | ||
1482 | } | 1484 | } |
1483 | } | 1485 | } |
1484 | } else { // no conflict ********** add or delete remote | 1486 | } else { // no conflict ********** add or delete remote |
1485 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1487 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1486 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1488 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1487 | QString des = eventLSync->description(); | 1489 | QString des = eventLSync->description(); |
1488 | QString pref = "e"; | 1490 | QString pref = "e"; |
1489 | if ( inR->typeID() == todoID ) | 1491 | if ( inR->typeID() == todoID ) |
1490 | pref = "t"; | 1492 | pref = "t"; |
1491 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1493 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1492 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1494 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1493 | //remote->deleteIncidence( inR ); | 1495 | //remote->deleteIncidence( inR ); |
1494 | ++deletedEventR; | 1496 | ++deletedEventR; |
1495 | } else { | 1497 | } else { |
1496 | inR->setLastModified( modifiedCalendar ); | 1498 | inR->setLastModified( modifiedCalendar ); |
1497 | inL = inR->clone(); | 1499 | inL = inR->clone(); |
1498 | inL->setIDStr( ":" ); | 1500 | inL->setIDStr( ":" ); |
1499 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1501 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1500 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1502 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1501 | 1503 | ||
1502 | inL->setCalID( 0 );// add to default cal | 1504 | inL->setCalID( 0 );// add to default cal |
1503 | local->addIncidence( inL ); | 1505 | local->addIncidence( inL ); |
1504 | ++addedEvent; | 1506 | ++addedEvent; |
1505 | 1507 | ||
1506 | } | 1508 | } |
1507 | } else { | 1509 | } else { |
1508 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1510 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1509 | inR->setLastModified( modifiedCalendar ); | 1511 | inR->setLastModified( modifiedCalendar ); |
1510 | inL = inR->clone(); | 1512 | inL = inR->clone(); |
1511 | inL->setIDStr( ":" ); | 1513 | inL->setIDStr( ":" ); |
1512 | inL->setCalID( 0 );// add to default cal | 1514 | inL->setCalID( 0 );// add to default cal |
1513 | local->addIncidence( inL ); | 1515 | local->addIncidence( inL ); |
1514 | ++addedEvent; | 1516 | ++addedEvent; |
1515 | 1517 | ||
1516 | } else { | 1518 | } else { |
1517 | checkExternSyncEvent(eventRSyncSharp, inR); | 1519 | checkExternSyncEvent(eventRSyncSharp, inR); |
1518 | remote->deleteIncidence( inR ); | 1520 | remote->deleteIncidence( inR ); |
1519 | ++deletedEventR; | 1521 | ++deletedEventR; |
1520 | } | 1522 | } |
1521 | } | 1523 | } |
1522 | } else { | 1524 | } else { |
1523 | ++filteredIN; | 1525 | ++filteredIN; |
1524 | } | 1526 | } |
1525 | } | 1527 | } |
1526 | } | 1528 | } |
1527 | inR = er.next(); | 1529 | inR = er.next(); |
1528 | } | 1530 | } |
1529 | QPtrList<Incidence> el = local->rawIncidences(); | 1531 | QPtrList<Incidence> el = local->rawIncidences(); |
1530 | inL = el.first(); | 1532 | inL = el.first(); |
1531 | modulo = (el.count()/10)+1; | 1533 | modulo = (el.count()/10)+1; |
1532 | bar.setCaption (i18n("Add / remove events") ); | 1534 | bar.setCaption (i18n("Add / remove events") ); |
1533 | bar.setTotalSteps ( el.count() ) ; | 1535 | bar.setTotalSteps ( el.count() ) ; |
1534 | bar.show(); | 1536 | bar.show(); |
1535 | incCounter = 0; | 1537 | incCounter = 0; |
1536 | 1538 | ||
1537 | while ( inL ) { | 1539 | while ( inL ) { |
1538 | 1540 | ||
1539 | qApp->processEvents(); | 1541 | qApp->processEvents(); |
1540 | if ( ! bar.isVisible() ) | 1542 | if ( ! bar.isVisible() ) |
1541 | return false; | 1543 | return false; |
1542 | if ( incCounter % modulo == 0 ) | 1544 | if ( incCounter % modulo == 0 ) |
1543 | bar.setProgress( incCounter ); | 1545 | bar.setProgress( incCounter ); |
1544 | ++incCounter; | 1546 | ++incCounter; |
1545 | uid = inL->uid(); | 1547 | uid = inL->uid(); |
1546 | bool skipIncidence = false; | 1548 | bool skipIncidence = false; |
1547 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1549 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1548 | skipIncidence = true; | 1550 | skipIncidence = true; |
1549 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) | 1551 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) |
1550 | skipIncidence = true; | 1552 | skipIncidence = true; |
1551 | if ( !skipIncidence ) { | 1553 | if ( !skipIncidence ) { |
1552 | inR = remote->incidence( uid ); | 1554 | inR = remote->incidenceForUid( uid , true ); |
1553 | if ( ! inR ) { | 1555 | if ( ! inR ) { |
1554 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1556 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1555 | // no conflict ********** add or delete local | 1557 | // no conflict ********** add or delete local |
1556 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1558 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1557 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1559 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1558 | checkExternSyncEvent(eventLSyncSharp, inL); | 1560 | checkExternSyncEvent(eventLSyncSharp, inL); |
1559 | local->deleteIncidence( inL ); | 1561 | local->deleteIncidence( inL ); |
1560 | ++deletedEventL; | 1562 | ++deletedEventL; |
1561 | } else { | 1563 | } else { |
1562 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1564 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1563 | inL->removeID(mCurrentSyncDevice ); | 1565 | inL->removeID(mCurrentSyncDevice ); |
1564 | ++addedEventR; | 1566 | ++addedEventR; |
1565 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1567 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1566 | inL->setLastModified( modifiedCalendar ); | 1568 | inL->setLastModified( modifiedCalendar ); |
1567 | inR = inL->clone(); | 1569 | inR = inL->clone(); |
1568 | inR->setIDStr( ":" ); | 1570 | inR->setIDStr( ":" ); |
1569 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1571 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1570 | inR->setCalID( 0 );// add to default cal | 1572 | inR->setCalID( 0 );// add to default cal |
1571 | remote->addIncidence( inR ); | 1573 | remote->addIncidence( inR ); |
1572 | } | 1574 | } |
1573 | } | 1575 | } |
1574 | } else { | 1576 | } else { |
1575 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1577 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1576 | checkExternSyncEvent(eventLSyncSharp, inL); | 1578 | checkExternSyncEvent(eventLSyncSharp, inL); |
1577 | local->deleteIncidence( inL ); | 1579 | local->deleteIncidence( inL ); |
1578 | ++deletedEventL; | 1580 | ++deletedEventL; |
1579 | } else { | 1581 | } else { |
1580 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1582 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1581 | ++addedEventR; | 1583 | ++addedEventR; |
1582 | inL->setLastModified( modifiedCalendar ); | 1584 | inL->setLastModified( modifiedCalendar ); |
1583 | inR = inL->clone(); | 1585 | inR = inL->clone(); |
1584 | inR->setIDStr( ":" ); | 1586 | inR->setIDStr( ":" ); |
1585 | inR->setCalID( 0 );// add to default cal | 1587 | inR->setCalID( 0 );// add to default cal |
1586 | remote->addIncidence( inR ); | 1588 | remote->addIncidence( inR ); |
1587 | } | 1589 | } |
1588 | } | 1590 | } |
1589 | } | 1591 | } |
1590 | } else { | 1592 | } else { |
1591 | ++filteredOUT; | 1593 | ++filteredOUT; |
1592 | } | 1594 | } |
1593 | } | 1595 | } |
1594 | } | 1596 | } |
1595 | inL = el.next(); | 1597 | inL = el.next(); |
1596 | } | 1598 | } |
1597 | int delFut = 0; | 1599 | int delFut = 0; |
1598 | int remRem = 0; | 1600 | int remRem = 0; |
1599 | if ( mSyncManager->mWriteBackInFuture ) { | 1601 | if ( mSyncManager->mWriteBackInFuture ) { |
1600 | er = remote->rawIncidences(); | 1602 | er = remote->rawIncidences(); |
1601 | remRem = er.count(); | 1603 | remRem = er.count(); |
1602 | inR = er.first(); | 1604 | inR = er.first(); |
1603 | QDateTime dt; | 1605 | QDateTime dt; |
1604 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); | 1606 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); |
1605 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); | 1607 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); |
1606 | while ( inR ) { | 1608 | while ( inR ) { |
1607 | if ( inR->typeID() == todoID ) { | 1609 | if ( inR->typeID() == todoID ) { |
1608 | Todo * t = (Todo*)inR; | 1610 | Todo * t = (Todo*)inR; |
1609 | if ( t->hasDueDate() ) | 1611 | if ( t->hasDueDate() ) |
1610 | dt = t->dtDue(); | 1612 | dt = t->dtDue(); |
1611 | else | 1613 | else |
1612 | dt = cur.addSecs( 62 ); | 1614 | dt = cur.addSecs( 62 ); |
1613 | } | 1615 | } |
1614 | else if (inR->typeID() == eventID ) { | 1616 | else if (inR->typeID() == eventID ) { |
1615 | bool ok; | 1617 | bool ok; |
1616 | dt = inR->getNextOccurence( cur, &ok ); | 1618 | dt = inR->getNextOccurence( cur, &ok ); |
1617 | if ( !ok ) | 1619 | if ( !ok ) |
1618 | dt = cur.addSecs( -62 ); | 1620 | dt = cur.addSecs( -62 ); |
1619 | } | 1621 | } |
1620 | else | 1622 | else |
1621 | dt = inR->dtStart(); | 1623 | dt = inR->dtStart(); |
1622 | if ( dt < cur || dt > end ) { | 1624 | if ( dt < cur || dt > end ) { |
1623 | remote->deleteIncidence( inR ); | 1625 | remote->deleteIncidence( inR ); |
1624 | ++delFut; | 1626 | ++delFut; |
1625 | } | 1627 | } |
1626 | inR = er.next(); | 1628 | inR = er.next(); |
1627 | } | 1629 | } |
1628 | } | 1630 | } |
1629 | bar.hide(); | 1631 | bar.hide(); |
1630 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1632 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1631 | eventLSync->setReadOnly( false ); | 1633 | eventLSync->setReadOnly( false ); |
1632 | eventLSync->setDtStart( mLastCalendarSync ); | 1634 | eventLSync->setDtStart( mLastCalendarSync ); |
1633 | eventRSync->setDtStart( mLastCalendarSync ); | 1635 | eventRSync->setDtStart( mLastCalendarSync ); |
1634 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1636 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1635 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1637 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1636 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1638 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1637 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1639 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1638 | eventLSync->setReadOnly( true ); | 1640 | eventLSync->setReadOnly( true ); |
1639 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); | 1641 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); |
1640 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1642 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1641 | remote->addEvent( eventRSync ); | 1643 | remote->addEvent( eventRSync ); |
1642 | else | 1644 | else |
1643 | delete eventRSync; | 1645 | delete eventRSync; |
1644 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); | 1646 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); |
1645 | QString mes; | 1647 | QString mes; |
1646 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); | 1648 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); |
1647 | QString delmess; | 1649 | QString delmess; |
1648 | if ( delFut ) { | 1650 | if ( delFut ) { |
1649 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1651 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1650 | mes += delmess; | 1652 | mes += delmess; |
1651 | } | 1653 | } |
1652 | mes = i18n("Local calendar changed!\n") +mes; | 1654 | mes = i18n("Local calendar changed!\n") +mes; |
1653 | mCalendar->checkAlarmForIncidence( 0, true ); | 1655 | mCalendar->checkAlarmForIncidence( 0, true ); |
1654 | qDebug( mes ); | 1656 | qDebug( mes ); |
1655 | if ( mSyncManager->mShowSyncSummary ) { | 1657 | if ( mSyncManager->mShowSyncSummary ) { |
1656 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 1658 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1657 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | 1659 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { |
1658 | qDebug("KO: WB cancelled "); | 1660 | qDebug("KO: WB cancelled "); |
1659 | mSyncManager->mWriteBackFile = false; | 1661 | mSyncManager->mWriteBackFile = false; |
1660 | return syncOK; | 1662 | return syncOK; |
1661 | } | 1663 | } |
1662 | } | 1664 | } |
1663 | return syncOK; | 1665 | return syncOK; |
1664 | } | 1666 | } |
1665 | 1667 | ||
1666 | void CalendarView::setSyncDevice( QString s ) | 1668 | void CalendarView::setSyncDevice( QString s ) |
1667 | { | 1669 | { |
1668 | mCurrentSyncDevice= s; | 1670 | mCurrentSyncDevice= s; |
1669 | } | 1671 | } |
1670 | void CalendarView::setSyncName( QString s ) | 1672 | void CalendarView::setSyncName( QString s ) |
1671 | { | 1673 | { |
1672 | mCurrentSyncName= s; | 1674 | mCurrentSyncName= s; |
1673 | } | 1675 | } |
1674 | bool CalendarView::syncCalendar(QString filename, int mode) | 1676 | bool CalendarView::syncCalendar(QString filename, int mode) |
1675 | { | 1677 | { |
1676 | //qDebug("syncCalendar %s ", filename.latin1()); | 1678 | //qDebug("syncCalendar %s ", filename.latin1()); |
1677 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1679 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1678 | CalendarLocal* calendar = new CalendarLocal(); | 1680 | CalendarLocal* calendar = new CalendarLocal(); |
1679 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1681 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1680 | FileStorage* storage = new FileStorage( calendar ); | 1682 | FileStorage* storage = new FileStorage( calendar ); |
1681 | bool syncOK = false; | 1683 | bool syncOK = false; |
1682 | storage->setFileName( filename ); | 1684 | storage->setFileName( filename ); |
1683 | // qDebug("loading ... "); | 1685 | // qDebug("loading ... "); |
1684 | if ( storage->load() ) { | 1686 | if ( storage->load() ) { |
1685 | getEventViewerDialog()->setSyncMode( true ); | 1687 | getEventViewerDialog()->setSyncMode( true ); |
1686 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1688 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1687 | getEventViewerDialog()->setSyncMode( false ); | 1689 | getEventViewerDialog()->setSyncMode( false ); |
1688 | if ( syncOK ) { | 1690 | if ( syncOK ) { |
1689 | if ( mSyncManager->mWriteBackFile ) | 1691 | if ( mSyncManager->mWriteBackFile ) |
1690 | { | 1692 | { |
1691 | storage->setSaveFormat( new ICalFormat() ); | 1693 | storage->setSaveFormat( new ICalFormat() ); |
1692 | storage->save(); | 1694 | storage->save(); |
1693 | } | 1695 | } |
1694 | } | 1696 | } |
1695 | setModified( true ); | 1697 | setModified( true ); |
1696 | } | 1698 | } |
1697 | delete storage; | 1699 | delete storage; |
1698 | delete calendar; | 1700 | delete calendar; |
1699 | if ( syncOK ) | 1701 | if ( syncOK ) |
1700 | updateView(); | 1702 | updateView(); |
1701 | return syncOK; | 1703 | return syncOK; |
1702 | } | 1704 | } |
1703 | 1705 | ||
1704 | void CalendarView::syncExternal( int mode ) | 1706 | void CalendarView::syncExternal( int mode ) |
1705 | { | 1707 | { |
1706 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1708 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1707 | 1709 | ||
1708 | qApp->processEvents(); | 1710 | qApp->processEvents(); |
1709 | CalendarLocal* calendar = new CalendarLocal(); | 1711 | CalendarLocal* calendar = new CalendarLocal(); |
1710 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1712 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1711 | bool syncOK = false; | 1713 | bool syncOK = false; |
1712 | bool loadSuccess = false; | 1714 | bool loadSuccess = false; |
1713 | PhoneFormat* phoneFormat = 0; | 1715 | PhoneFormat* phoneFormat = 0; |
1714 | emit tempDisableBR(true); | 1716 | emit tempDisableBR(true); |
1715 | #ifndef DESKTOP_VERSION | 1717 | #ifndef DESKTOP_VERSION |
1716 | SharpFormat* sharpFormat = 0; | 1718 | SharpFormat* sharpFormat = 0; |
1717 | if ( mode == 0 ) { // sharp | 1719 | if ( mode == 0 ) { // sharp |
1718 | sharpFormat = new SharpFormat () ; | 1720 | sharpFormat = new SharpFormat () ; |
1719 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1721 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1720 | 1722 | ||
1721 | } else | 1723 | } else |
1722 | #endif | 1724 | #endif |
1723 | if ( mode == 1 ) { // phone | 1725 | if ( mode == 1 ) { // phone |
1724 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1726 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1725 | mSyncManager->mPhoneDevice, | 1727 | mSyncManager->mPhoneDevice, |
1726 | mSyncManager->mPhoneConnection, | 1728 | mSyncManager->mPhoneConnection, |
1727 | mSyncManager->mPhoneModel); | 1729 | mSyncManager->mPhoneModel); |
1728 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1730 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1729 | 1731 | ||
1730 | } else { | 1732 | } else { |
1731 | emit tempDisableBR(false); | 1733 | emit tempDisableBR(false); |
1732 | return; | 1734 | return; |
1733 | } | 1735 | } |
1734 | if ( loadSuccess ) { | 1736 | if ( loadSuccess ) { |
1735 | getEventViewerDialog()->setSyncMode( true ); | 1737 | getEventViewerDialog()->setSyncMode( true ); |
1736 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1738 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1737 | getEventViewerDialog()->setSyncMode( false ); | 1739 | getEventViewerDialog()->setSyncMode( false ); |
1738 | qApp->processEvents(); | 1740 | qApp->processEvents(); |
1739 | if ( syncOK ) { | 1741 | if ( syncOK ) { |
1740 | if ( mSyncManager->mWriteBackFile ) | 1742 | if ( mSyncManager->mWriteBackFile ) |
1741 | { | 1743 | { |
1742 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1744 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1743 | Incidence* inc = iL.first(); | 1745 | Incidence* inc = iL.first(); |
1744 | if ( phoneFormat ) { | 1746 | if ( phoneFormat ) { |