-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 7 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 27 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 5 |
5 files changed, 31 insertions, 11 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 3da24c5..8127ef4 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,271 +1,271 @@ | |||
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.16 ************ | 3 | ********** VERSION 2.1.16 ************ |
4 | 4 | ||
5 | 5 | Fixed a problem with the menu bar in KO/Pi and using the "Menu" hardware key on the Zaurus. | |
6 | 6 | ||
7 | ********** VERSION 2.1.15 ************ | 7 | ********** VERSION 2.1.15 ************ |
8 | 8 | ||
9 | Fixed two layout problems on the Z: | 9 | Fixed two layout problems on the Z: |
10 | Made the with of the newly added buttons on the Quick-Todo smaller. | 10 | Made the with of the newly added buttons on the Quick-Todo smaller. |
11 | Made listweek layout in 2 columns on the Z760 in portait screen and full menubar visible. | 11 | Made listweek layout in 2 columns on the Z760 in portait screen and full menubar visible. |
12 | 12 | ||
13 | 13 | ||
14 | ********** VERSION 2.1.14 ************ | 14 | ********** VERSION 2.1.14 ************ |
15 | 15 | ||
16 | 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. | 16 | 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. |
17 | Added a button to add a subtodo quickly. | 17 | Added a button to add a subtodo quickly. |
18 | 18 | ||
19 | Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ). | 19 | Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ). |
20 | Added an option to change the layout of the list week to column mode. | 20 | Added an option to change the layout of the list week to column mode. |
21 | 21 | ||
22 | Fixed some usability problems in pi-sync mode by adding some progress information about file transfer. | 22 | Fixed some usability problems in pi-sync mode by adding some progress information about file transfer. |
23 | 23 | ||
24 | Fixed pi-sync problems with the new multi calendar feature. | 24 | Fixed pi-sync problems with the new multi calendar feature. |
25 | Now pi-sync behaviour should be: | 25 | Now pi-sync behaviour should be: |
26 | 1) Local sends file request ( as usual ) | 26 | 1) Local sends file request ( as usual ) |
27 | 2) Remote sends file which contains data of all enabled ( the calendar where the "eye" column is checked ) calendars. | 27 | 2) Remote sends file which contains data of all enabled ( the calendar where the "eye" column is checked ) calendars. |
28 | 3) Local syncs with data, adds new entries to default calendar and sends file back ( as usual ). | 28 | 3) Local syncs with data, adds new entries to default calendar and sends file back ( as usual ). |
29 | 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. | 29 | 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. |
30 | 4) Remote updates the data and adds new entries to default calendar. Readonly entries are not changed on remote. | 30 | 4) Remote updates the data and adds new entries to default calendar. Readonly entries are not changed on remote. |
31 | 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. | 31 | 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. |
32 | 32 | ||
33 | Summary: | 33 | Summary: |
34 | 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. | 34 | 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. |
35 | If you have different calendars on remote and local and some of them disabled you may get some "strange" bahaviour. | 35 | If you have different calendars on remote and local and some of them disabled you may get some "strange" bahaviour. |
36 | Well, the syncing has become quite complicated ... you should have no problems if you enable all calendars. | 36 | Well, the syncing has become quite complicated ... you should have no problems if you enable all calendars. |
37 | 37 | ||
38 | ********** VERSION 2.1.13 ************ | 38 | ********** VERSION 2.1.13 ************ |
39 | 39 | ||
40 | Fixed a problem in KA/Pi search. | 40 | Fixed a problem in KA/Pi search. |
41 | Fixed some minor problems in KO/Pi. | 41 | Fixed some minor problems in KO/Pi. |
42 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. | 42 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. |
43 | 43 | ||
44 | Fixed memory usage problems in KA/Pi: | 44 | Fixed memory usage problems in KA/Pi: |
45 | When loading data KA/Pi did load the file data twice. | 45 | When loading data KA/Pi did load the file data twice. |
46 | Example: | 46 | Example: |
47 | A 600k file did consume 1200k memory during loading process. | 47 | A 600k file did consume 1200k memory during loading process. |
48 | This is fixed, it does now consume only 600k during loading process. | 48 | This is fixed, it does now consume only 600k during loading process. |
49 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. | 49 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. |
50 | This is fixed. | 50 | This is fixed. |
51 | Example: | 51 | Example: |
52 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. | 52 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. |
53 | 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. | 53 | 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. |
54 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. | 54 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. |
55 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. | 55 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. |
56 | The saving of data may be a bit slower now. | 56 | The saving of data may be a bit slower now. |
57 | 57 | ||
58 | Fixed memory usage problems in KO/Pi: | 58 | Fixed memory usage problems in KO/Pi: |
59 | When KO/Pi did save the data to file, it did not release the used buffers after saving. | 59 | When KO/Pi did save the data to file, it did not release the used buffers after saving. |
60 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. | 60 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. |
61 | This is fixed. | 61 | This is fixed. |
62 | Example: | 62 | Example: |
63 | When saving a 400k file KO/Pi do now use 400k less memory now. | 63 | When saving a 400k file KO/Pi do now use 400k less memory now. |
64 | 64 | ||
65 | Optimized memory usage in KO/Pi Agenda view: | 65 | Optimized memory usage in KO/Pi Agenda view: |
66 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. | 66 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. |
67 | These buffers were not made smaller (i.e. downsized) because of performance reasons. | 67 | These buffers were not made smaller (i.e. downsized) because of performance reasons. |
68 | The handling of these buffers are now much smarter: | 68 | The handling of these buffers are now much smarter: |
69 | Two (of six) buffers are removed completely. | 69 | Two (of six) buffers are removed completely. |
70 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. | 70 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. |
71 | 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. | 71 | 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. |
72 | 72 | ||
73 | Worst case example ( for a maximum size agenda content): | 73 | Worst case example ( for a maximum size agenda content): |
74 | 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. | 74 | 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. |
75 | 75 | ||
76 | 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. | 76 | 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. |
77 | 77 | ||
78 | Summary: | 78 | Summary: |
79 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. | 79 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. |
80 | 80 | ||
81 | ********** VERSION 2.1.12 ************ | 81 | ********** VERSION 2.1.12 ************ |
82 | 82 | ||
83 | KO/Pi: | 83 | KO/Pi: |
84 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. | 84 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. |
85 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. | 85 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. |
86 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). | 86 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). |
87 | Fixed some other small problems. | 87 | Fixed some other small problems. |
88 | 88 | ||
89 | ********** VERSION 2.1.11 ************ | 89 | ********** VERSION 2.1.11 ************ |
90 | 90 | ||
91 | KO/Pi: | 91 | KO/Pi: |
92 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. | 92 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. |
93 | Added features to handle (and add ) more than one journal entry per day. | 93 | Added features to handle (and add ) more than one journal entry per day. |
94 | Added option for a journal title. | 94 | Added option for a journal title. |
95 | 95 | ||
96 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. | 96 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. |
97 | Fixed a problem of the alarm of completed recurring todos. | 97 | Fixed a problem of the alarm of completed recurring todos. |
98 | Added to the event/todo editor to set quickly the category of an item. | 98 | Added to the event/todo editor to set quickly the category of an item. |
99 | 99 | ||
100 | 100 | ||
101 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. | 101 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. |
102 | 102 | ||
103 | Added KA/Pi multi sync to the multi sync called from the alarm applet. | 103 | Added KA/Pi multi sync to the multi sync called from the alarm applet. |
104 | 104 | ||
105 | ********** VERSION 2.1.10 ************ | 105 | ********** VERSION 2.1.10 ************ |
106 | 106 | ||
107 | KO/Pi: | 107 | KO/Pi: |
108 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. | 108 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. |
109 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. | 109 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. |
110 | Fixed a bug in searching for a small timerange, i.e. one day. | 110 | Fixed a bug in searching for a small timerange, i.e. one day. |
111 | 111 | ||
112 | KA/Pi: | 112 | KA/Pi: |
113 | Fixed two problems in csv export. | 113 | Fixed two problems in csv export. |
114 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. | 114 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. |
115 | 115 | ||
116 | ********** VERSION 2.1.9 ************ | 116 | ********** VERSION 2.1.9 ************ |
117 | 117 | ||
118 | KO/Pi: | 118 | KO/Pi: |
119 | Fixed some problems of the new search options in the search dialog. | 119 | Fixed some problems of the new search options in the search dialog. |
120 | Fixed some problems in the new resource config options. | 120 | Fixed some problems in the new resource config options. |
121 | 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. | 121 | 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. |
122 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: | 122 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: |
123 | 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. | 123 | 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. |
124 | 124 | ||
125 | Fixed a problem in recurrence range in syncing with DTM. | 125 | Fixed a problem in recurrence range in syncing with DTM. |
126 | 126 | ||
127 | KA/Pi: | 127 | KA/Pi: |
128 | Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) | 128 | Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) |
129 | 129 | ||
130 | PwM/Pi: | 130 | PwM/Pi: |
131 | Added "sec" to the timeout config settings to make it clear the timeout values are seconds. | 131 | Added "sec" to the timeout config settings to make it clear the timeout values are seconds. |
132 | 132 | ||
133 | ********** VERSION 2.1.8 ************ | 133 | ********** VERSION 2.1.8 ************ |
134 | 134 | ||
135 | KO/Pi: | 135 | KO/Pi: |
136 | Added info about the completion state of a todo in the ListView/Searchdialog. | 136 | Added info about the completion state of a todo in the ListView/Searchdialog. |
137 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. | 137 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. |
138 | Fixed some updating problems when changing the filter. | 138 | Fixed some updating problems when changing the filter. |
139 | 139 | ||
140 | KA/Pi: | 140 | KA/Pi: |
141 | In the addressee selection dialog now the formatted name is shown, if not empty. | 141 | In the addressee selection dialog now the formatted name is shown, if not empty. |
142 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. | 142 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. |
143 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. | 143 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. |
144 | 144 | ||
145 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. | 145 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. |
146 | Fixed the sorting for size in the file selector on the Z. | 146 | Fixed the sorting for size in the file selector on the Z. |
147 | 147 | ||
148 | Changed the color selection dialog on the Zaurus to a more user friendly version. | 148 | Changed the color selection dialog on the Zaurus to a more user friendly version. |
149 | 149 | ||
150 | ********** VERSION 2.1.7 ************ | 150 | ********** VERSION 2.1.7 ************ |
151 | 151 | ||
152 | KO/Pi: | 152 | KO/Pi: |
153 | Fixed several problems in the new Resource handling. | 153 | Fixed several problems in the new Resource handling. |
154 | Added more options to the search dialog. | 154 | Added more options to the search dialog. |
155 | Fixed a problem in the Month view. | 155 | Fixed a problem in the Month view. |
156 | Added more options to the dialog when setting a todo to stopped. | 156 | Added more options to the dialog when setting a todo to stopped. |
157 | 157 | ||
158 | Fixed two small problems in KO/Pi Alarm applet. | 158 | Fixed two small problems in KO/Pi Alarm applet. |
159 | 159 | ||
160 | ********** VERSION 2.1.6 ************ | 160 | ********** VERSION 2.1.6 ************ |
161 | 161 | ||
162 | This release is for testing only. | 162 | This release is for testing only. |
163 | 163 | ||
164 | KO/Pi: | 164 | KO/Pi: |
165 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. | 165 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. |
166 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. | 166 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. |
167 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. | 167 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. |
168 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. | 168 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. |
169 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. | 169 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. |
170 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. | 170 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. |
171 | 171 | ||
172 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. | 172 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. |
173 | 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. | 173 | 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. |
174 | Now on every sync the set of calendars is synced which are enabled in the resource view. | 174 | Now on every sync the set of calendars is synced which are enabled in the resource view. |
175 | 175 | ||
176 | A calendar is enabled in the resource view if the "eye" column is checked. | 176 | A calendar is enabled in the resource view if the "eye" column is checked. |
177 | You can set a calendar to be the default for new items( "+" column ). | 177 | You can set a calendar to be the default for new items( "+" column ). |
178 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. | 178 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. |
179 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... | 179 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... |
180 | 180 | ||
181 | 181 | ||
182 | ********** VERSION 2.1.5 ************ | 182 | ********** VERSION 2.1.5 ************ |
183 | 183 | ||
184 | This is the new stable version. | 184 | This is the new stable version. |
185 | Bugfix: | 185 | Bugfix: |
186 | Fixed a problem with agenda popup on the desktop in KO/Pi. | 186 | Fixed a problem with agenda popup on the desktop in KO/Pi. |
187 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. | 187 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. |
188 | Added config option to not display completed todos in agenda view. | 188 | Added config option to not display completed todos in agenda view. |
189 | Addressee view is now using the formatted name, if defined. | 189 | Addressee view is now using the formatted name, if defined. |
190 | That makes it possible to display "lastname, firstname" in that view now. | 190 | That makes it possible to display "lastname, firstname" in that view now. |
191 | To set the formatted name for all contacts, please use menu: | 191 | To set the formatted name for all contacts, please use menu: |
192 | Edit->Change->Set formatted name. | 192 | Edit->Change->Set formatted name. |
193 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. | 193 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. |
194 | 194 | ||
195 | ********** VERSION 2.1.4 ************ | 195 | ********** VERSION 2.1.4 ************ |
196 | 196 | ||
197 | Fixed two more bugs in the KA/Pi CSV import dialog: | 197 | Fixed two more bugs in the KA/Pi CSV import dialog: |
198 | Made it possible to read multi-line fields and import it to the "Note" field. | 198 | Made it possible to read multi-line fields and import it to the "Note" field. |
199 | Fixed a problem in mapping custom fields, whatever a custem field is... | 199 | Fixed a problem in mapping custom fields, whatever a custem field is... |
200 | 200 | ||
201 | ********** VERSION 2.1.3 ************ | 201 | ********** VERSION 2.1.3 ************ |
202 | 202 | ||
203 | Changed the menu structure of the alarm applet: | 203 | Changed the menu structure of the alarm applet: |
204 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". | 204 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". |
205 | 205 | ||
206 | Fixed several problems in the KA/Pi CSV import dialog: | 206 | Fixed several problems in the KA/Pi CSV import dialog: |
207 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. | 207 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. |
208 | 208 | ||
209 | 209 | ||
210 | ********** VERSION 2.1.2 ************ | 210 | ********** VERSION 2.1.2 ************ |
211 | 211 | ||
212 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. | 212 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. |
213 | 213 | ||
214 | Fixed a problem when importing data from Outlook with mutiple categories set. | 214 | Fixed a problem when importing data from Outlook with mutiple categories set. |
215 | 215 | ||
216 | Changed display of days in datenavigator: | 216 | Changed display of days in datenavigator: |
217 | Birthdays are now blue, not dark green. | 217 | Birthdays are now blue, not dark green. |
218 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. | 218 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. |
219 | When journal view is shown, only holidays are shown and days with journals are blue. | 219 | When journal view is shown, only holidays are shown and days with journals are blue. |
220 | 220 | ||
221 | Added Backup options to global config: | 221 | Added Backup options to global config: |
222 | 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 ). | 222 | 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 ). |
223 | 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. | 223 | 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. |
224 | 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. | 224 | 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. |
225 | 225 | ||
226 | ********** VERSION 2.1.1 ************ | 226 | ********** VERSION 2.1.1 ************ |
227 | 227 | ||
228 | Stable release 2.1.1! | 228 | Stable release 2.1.1! |
229 | 229 | ||
230 | KO/Pi: | 230 | KO/Pi: |
231 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. | 231 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. |
232 | 232 | ||
233 | ********** VERSION 2.1.0 ************ | 233 | ********** VERSION 2.1.0 ************ |
234 | 234 | ||
235 | Stable release 2.1.0! | 235 | Stable release 2.1.0! |
236 | 236 | ||
237 | Summary of changes/fixes compared to version 2.0.6: | 237 | Summary of changes/fixes compared to version 2.0.6: |
238 | 238 | ||
239 | Many bugs of version 2.0.6 fixed. | 239 | Many bugs of version 2.0.6 fixed. |
240 | Most of them were small bugs, but some of them were important. | 240 | Most of them were small bugs, but some of them were important. |
241 | It is recommended to use version 2.1.0 and not version 2.0.6. | 241 | It is recommended to use version 2.1.0 and not version 2.0.6. |
242 | 242 | ||
243 | Important changes: | 243 | Important changes: |
244 | 244 | ||
245 | Added recurring todos to KO/Pi. | 245 | Added recurring todos to KO/Pi. |
246 | 246 | ||
247 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. | 247 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. |
248 | 248 | ||
249 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 249 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
250 | 250 | ||
251 | Datenavigator can now display many months. Very useful on the desktop. | 251 | Datenavigator can now display many months. Very useful on the desktop. |
252 | 252 | ||
253 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. | 253 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. |
254 | 254 | ||
255 | Made alarm sound working on Linux desktop. | 255 | Made alarm sound working on Linux desktop. |
256 | 256 | ||
257 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. | 257 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. |
258 | 258 | ||
259 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. | 259 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. |
260 | 260 | ||
261 | Many other usebility enhancements. | 261 | Many other usebility enhancements. |
262 | Special thanks to Ben for his suggestions! | 262 | Special thanks to Ben for his suggestions! |
263 | 263 | ||
264 | You can find the complete changelog | 264 | You can find the complete changelog |
265 | from version 1.7.7 to 2.1.0 | 265 | from version 1.7.7 to 2.1.0 |
266 | in the source package or on | 266 | in the source package or on |
267 | 267 | ||
268 | http://www.pi-sync.net/html/changelog.html | 268 | http://www.pi-sync.net/html/changelog.html |
269 | 269 | ||
270 | 270 | ||
271 | 271 | ||
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 17f1659..a9e402e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,3735 +1,3730 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Requires the Qt and KDE widget libraries, available at no cost at | 4 | Requires the Qt and KDE widget libraries, available at no cost at |
5 | http://www.troll.no and http://www.kde.org respectively | 5 | http://www.troll.no and http://www.kde.org respectively |
6 | 6 | ||
7 | Copyright (c) 1997, 1998, 1999 | 7 | Copyright (c) 1997, 1998, 1999 |
8 | Preston Brown (preton.brown@yale.edu) | 8 | Preston Brown (preton.brown@yale.edu) |
9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) | 9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) |
10 | Ian Dawes (iadawes@globalserve.net) | 10 | Ian Dawes (iadawes@globalserve.net) |
11 | Laszlo Boloni (boloni@cs.purdue.edu) | 11 | Laszlo Boloni (boloni@cs.purdue.edu) |
12 | 12 | ||
13 | Copyright (c) 2000, 2001, 2002 | 13 | Copyright (c) 2000, 2001, 2002 |
14 | Cornelius Schumacher <schumacher@kde.org> | 14 | Cornelius Schumacher <schumacher@kde.org> |
15 | 15 | ||
16 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
17 | it under the terms of the GNU General Public License as published by | 17 | it under the terms of the GNU General Public License as published by |
18 | the Free Software Foundation; either version 2 of the License, or | 18 | the Free Software Foundation; either version 2 of the License, or |
19 | (at your option) any later version. | 19 | (at your option) any later version. |
20 | 20 | ||
21 | This program is distributed in the hope that it will be useful, | 21 | This program is distributed in the hope that it will be useful, |
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
24 | GNU General Public License for more details. | 24 | GNU General Public License for more details. |
25 | 25 | ||
26 | You should have received a copy of the GNU General Public License | 26 | You should have received a copy of the GNU General Public License |
27 | along with this program; if not, write to the Free Software | 27 | along with this program; if not, write to the Free Software |
28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
44 | #include <qptrlist.h> | 44 | #include <qptrlist.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #ifndef KORG_NOSPLITTER | 49 | #ifndef KORG_NOSPLITTER |
50 | #include <qsplitter.h> | 50 | #include <qsplitter.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | #include <kmessagebox.h> | 57 | #include <kmessagebox.h> |
58 | #include <knotifyclient.h> | 58 | #include <knotifyclient.h> |
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | 60 | ||
61 | #include <libkdepim/ksyncprefsdialog.h> | 61 | #include <libkdepim/ksyncprefsdialog.h> |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | #include <libkdepim/kpimglobalprefs.h> | 66 | #include <libkdepim/kpimglobalprefs.h> |
67 | 67 | ||
68 | #include <libkcal/vcaldrag.h> | 68 | #include <libkcal/vcaldrag.h> |
69 | #include <libkcal/icaldrag.h> | 69 | #include <libkcal/icaldrag.h> |
70 | #include <libkcal/icalformat.h> | 70 | #include <libkcal/icalformat.h> |
71 | #include <libkcal/vcalformat.h> | 71 | #include <libkcal/vcalformat.h> |
72 | #include <libkcal/scheduler.h> | 72 | #include <libkcal/scheduler.h> |
73 | #include <libkcal/calendarlocal.h> | 73 | #include <libkcal/calendarlocal.h> |
74 | #include <libkcal/journal.h> | 74 | #include <libkcal/journal.h> |
75 | #include <libkcal/calfilter.h> | 75 | #include <libkcal/calfilter.h> |
76 | #include <libkcal/attendee.h> | 76 | #include <libkcal/attendee.h> |
77 | #include <libkcal/dndfactory.h> | 77 | #include <libkcal/dndfactory.h> |
78 | #include <libkcal/freebusy.h> | 78 | #include <libkcal/freebusy.h> |
79 | #include <libkcal/filestorage.h> | 79 | #include <libkcal/filestorage.h> |
80 | #include <libkcal/calendarresources.h> | 80 | #include <libkcal/calendarresources.h> |
81 | #include <libkcal/qtopiaformat.h> | 81 | #include <libkcal/qtopiaformat.h> |
82 | #include "../kalarmd/alarmdialog.h" | 82 | #include "../kalarmd/alarmdialog.h" |
83 | 83 | ||
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | #include <libkcal/sharpformat.h> | 85 | #include <libkcal/sharpformat.h> |
86 | #include <externalapphandler.h> | 86 | #include <externalapphandler.h> |
87 | #endif | 87 | #endif |
88 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
89 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
90 | #include "komailclient.h" | 90 | #include "komailclient.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
93 | #include "calprinter.h" | 93 | #include "calprinter.h" |
94 | #endif | 94 | #endif |
95 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
96 | #include "kocore.h" | 96 | #include "kocore.h" |
97 | #endif | 97 | #endif |
98 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
99 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
100 | #include "koprefs.h" | 100 | #include "koprefs.h" |
101 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
102 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
103 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
104 | #include "koglobals.h" | 104 | #include "koglobals.h" |
105 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
106 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
107 | #include "koagenda.h" | 107 | #include "koagenda.h" |
108 | #include "kodialogmanager.h" | 108 | #include "kodialogmanager.h" |
109 | #include "outgoingdialog.h" | 109 | #include "outgoingdialog.h" |
110 | #include "incomingdialog.h" | 110 | #include "incomingdialog.h" |
111 | #include "datenavigatorcontainer.h" | 111 | #include "datenavigatorcontainer.h" |
112 | #include "statusdialog.h" | 112 | #include "statusdialog.h" |
113 | #include "kdatenavigator.h" | 113 | #include "kdatenavigator.h" |
114 | #include "kotodoview.h" | 114 | #include "kotodoview.h" |
115 | #include "datenavigator.h" | 115 | #include "datenavigator.h" |
116 | #include "resourceview.h" | 116 | #include "resourceview.h" |
117 | #include "navigatorbar.h" | 117 | #include "navigatorbar.h" |
118 | #include "searchdialog.h" | 118 | #include "searchdialog.h" |
119 | #include "mainwindow.h" | 119 | #include "mainwindow.h" |
120 | #include "categoryeditdialog.h" | 120 | #include "categoryeditdialog.h" |
121 | 121 | ||
122 | #include "calendarview.h" | 122 | #include "calendarview.h" |
123 | #ifndef DESKTOP_VERSION | 123 | #ifndef DESKTOP_VERSION |
124 | #include <qtopia/alarmserver.h> | 124 | #include <qtopia/alarmserver.h> |
125 | #endif | 125 | #endif |
126 | #ifndef _WIN32_ | 126 | #ifndef _WIN32_ |
127 | #include <stdlib.h> | 127 | #include <stdlib.h> |
128 | #include <stdio.h> | 128 | #include <stdio.h> |
129 | #include <unistd.h> | 129 | #include <unistd.h> |
130 | #else | 130 | #else |
131 | #include <qprocess.h> | 131 | #include <qprocess.h> |
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | #ifdef DESKTOP_VERSION | 134 | #ifdef DESKTOP_VERSION |
135 | #include <kabc/stdaddressbook.h> | 135 | #include <kabc/stdaddressbook.h> |
136 | #endif | 136 | #endif |
137 | using namespace KOrg; | 137 | using namespace KOrg; |
138 | using namespace KCal; | 138 | using namespace KCal; |
139 | extern int globalFlagBlockAgenda; | 139 | extern int globalFlagBlockAgenda; |
140 | extern int globalFlagBlockStartup; | 140 | extern int globalFlagBlockStartup; |
141 | 141 | ||
142 | 142 | ||
143 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) | 143 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) |
144 | 144 | ||
145 | { | 145 | { |
146 | mAlarms = alarms; | 146 | mAlarms = alarms; |
147 | viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); | 147 | viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); |
148 | QString mText = "<table width=\"100%\">\n"; | 148 | QString mText = "<table width=\"100%\">\n"; |
149 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 149 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
150 | #ifdef DESKTOP_VERSION | 150 | #ifdef DESKTOP_VERSION |
151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
152 | #else | 152 | #else |
153 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; | 153 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; |
154 | #endif | 154 | #endif |
155 | // mText += "<img src=\""; | 155 | // mText += "<img src=\""; |
156 | // mText += ipath; | 156 | // mText += ipath; |
157 | // mText += "\">"; | 157 | // mText += "\">"; |
158 | //mEventDate = QDate::currentDate(); | 158 | //mEventDate = QDate::currentDate(); |
159 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; | 160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; |
161 | #else | 161 | #else |
162 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; | 162 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; |
163 | #endif | 163 | #endif |
164 | //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | 164 | //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; |
165 | 165 | ||
166 | Incidence * inc = getNextInc( start ); | 166 | Incidence * inc = getNextInc( start ); |
167 | int time = 0; | 167 | int time = 0; |
168 | //mText += "<table>"; | 168 | //mText += "<table>"; |
169 | while ( inc ) { | 169 | while ( inc ) { |
170 | QDateTime dt ; | 170 | QDateTime dt ; |
171 | QString tempText = "<a "; | 171 | QString tempText = "<a "; |
172 | bool ok; | 172 | bool ok; |
173 | dt = inc->getNextOccurence( start, &ok ); | 173 | dt = inc->getNextOccurence( start, &ok ); |
174 | if ( !ok ) continue; | 174 | if ( !ok ) continue; |
175 | if ( inc->typeID() == eventID ) { | 175 | if ( inc->typeID() == eventID ) { |
176 | tempText += "href=\"event:"; | 176 | tempText += "href=\"event:"; |
177 | } else if ( inc->typeID() == todoID ) { | 177 | } else if ( inc->typeID() == todoID ) { |
178 | tempText += "href=\"todo:"; | 178 | tempText += "href=\"todo:"; |
179 | } | 179 | } |
180 | tempText += inc->uid() + "\">"; | 180 | tempText += inc->uid() + "\">"; |
181 | if ( inc->typeID() == todoID ) | 181 | if ( inc->typeID() == todoID ) |
182 | tempText += i18n("Todo: "); | 182 | tempText += i18n("Todo: "); |
183 | if ( inc->summary().length() > 0 ) | 183 | if ( inc->summary().length() > 0 ) |
184 | tempText += inc->summary(); | 184 | tempText += inc->summary(); |
185 | else | 185 | else |
186 | tempText += i18n("-no summary-"); | 186 | tempText += i18n("-no summary-"); |
187 | QString timestr; | 187 | QString timestr; |
188 | if (!inc->doesFloat()) | 188 | if (!inc->doesFloat()) |
189 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; | 189 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; |
190 | else | 190 | else |
191 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 191 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
192 | if ( dt.date() < QDate::currentDate() && time == 0 ) { | 192 | if ( dt.date() < QDate::currentDate() && time == 0 ) { |
193 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | 193 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; |
194 | mText += "<table>"; | 194 | mText += "<table>"; |
195 | time = 1; | 195 | time = 1; |
196 | } | 196 | } |
197 | if ( dt.date() == QDate::currentDate() && time <= 1 ) { | 197 | if ( dt.date() == QDate::currentDate() && time <= 1 ) { |
198 | if ( time > 0 ) | 198 | if ( time > 0 ) |
199 | mText +="</table>"; | 199 | mText +="</table>"; |
200 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; | 200 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; |
201 | mText += "<table>"; | 201 | mText += "<table>"; |
202 | time = 2; | 202 | time = 2; |
203 | 203 | ||
204 | } | 204 | } |
205 | if ( dt.date() > QDate::currentDate() && time <= 2 ) { | 205 | if ( dt.date() > QDate::currentDate() && time <= 2 ) { |
206 | if ( time > 0 ) | 206 | if ( time > 0 ) |
207 | mText +="</table>"; | 207 | mText +="</table>"; |
208 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; | 208 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; |
209 | mText += "<table>"; | 209 | mText += "<table>"; |
210 | time = 3; | 210 | time = 3; |
211 | } | 211 | } |
212 | mText +="<tr><td><b>"; | 212 | mText +="<tr><td><b>"; |
213 | mText += timestr; | 213 | mText += timestr; |
214 | mText += "</b></td><td>"; | 214 | mText += "</b></td><td>"; |
215 | mText += tempText; | 215 | mText += tempText; |
216 | mText += "</td></tr>\n"; | 216 | mText += "</td></tr>\n"; |
217 | inc = getNextInc( start ); | 217 | inc = getNextInc( start ); |
218 | } | 218 | } |
219 | mText +="</table>"; | 219 | mText +="</table>"; |
220 | setText( mText ); | 220 | setText( mText ); |
221 | } | 221 | } |
222 | 222 | ||
223 | MissedAlarmTextBrowser::~MissedAlarmTextBrowser() | 223 | MissedAlarmTextBrowser::~MissedAlarmTextBrowser() |
224 | { | 224 | { |
225 | //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); | 225 | //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); |
226 | } | 226 | } |
227 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) | 227 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) |
228 | { | 228 | { |
229 | QDateTime dt ; | 229 | QDateTime dt ; |
230 | Incidence * retInc; | 230 | Incidence * retInc; |
231 | Incidence * inc = mAlarms.first(); | 231 | Incidence * inc = mAlarms.first(); |
232 | if ( inc == 0 ) | 232 | if ( inc == 0 ) |
233 | return 0; | 233 | return 0; |
234 | bool ok; | 234 | bool ok; |
235 | dt = inc->getNextOccurence( start, &ok ); | 235 | dt = inc->getNextOccurence( start, &ok ); |
236 | if ( ! ok ) return 0; | 236 | if ( ! ok ) return 0; |
237 | QDateTime dtn ; | 237 | QDateTime dtn ; |
238 | retInc = inc; | 238 | retInc = inc; |
239 | inc = mAlarms.next(); | 239 | inc = mAlarms.next(); |
240 | while ( inc ) { | 240 | while ( inc ) { |
241 | dtn = inc->getNextOccurence( start, &ok ); | 241 | dtn = inc->getNextOccurence( start, &ok ); |
242 | if ( ! ok ) return 0; | 242 | if ( ! ok ) return 0; |
243 | if ( dtn < dt ) { | 243 | if ( dtn < dt ) { |
244 | dt = dtn; | 244 | dt = dtn; |
245 | retInc = inc; | 245 | retInc = inc; |
246 | } | 246 | } |
247 | inc = mAlarms.next(); | 247 | inc = mAlarms.next(); |
248 | } | 248 | } |
249 | mAlarms.remove( retInc ); | 249 | mAlarms.remove( retInc ); |
250 | return retInc; | 250 | return retInc; |
251 | 251 | ||
252 | } | 252 | } |
253 | void MissedAlarmTextBrowser::setSource(const QString & n) | 253 | void MissedAlarmTextBrowser::setSource(const QString & n) |
254 | { | 254 | { |
255 | if (n.startsWith("event:")) { | 255 | if (n.startsWith("event:")) { |
256 | #ifdef DESKTOP_VERSION | 256 | #ifdef DESKTOP_VERSION |
257 | emit showIncidence(n.mid(8)); | 257 | emit showIncidence(n.mid(8)); |
258 | #else | 258 | #else |
259 | emit showIncidence(n.mid(6)); | 259 | emit showIncidence(n.mid(6)); |
260 | #endif | 260 | #endif |
261 | return; | 261 | return; |
262 | } else if (n.startsWith("todo:")) { | 262 | } else if (n.startsWith("todo:")) { |
263 | #ifdef DESKTOP_VERSION | 263 | #ifdef DESKTOP_VERSION |
264 | emit showIncidence(n.mid(7)); | 264 | emit showIncidence(n.mid(7)); |
265 | #else | 265 | #else |
266 | emit showIncidence(n.mid(5)); | 266 | emit showIncidence(n.mid(5)); |
267 | #endif | 267 | #endif |
268 | return; | 268 | return; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | class KOBeamPrefs : public QDialog | 273 | class KOBeamPrefs : public QDialog |
274 | { | 274 | { |
275 | public: | 275 | public: |
276 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 276 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
277 | QDialog( parent, name, true ) | 277 | QDialog( parent, name, true ) |
278 | { | 278 | { |
279 | setCaption( i18n("Beam Options") ); | 279 | setCaption( i18n("Beam Options") ); |
280 | QVBoxLayout* lay = new QVBoxLayout( this ); | 280 | QVBoxLayout* lay = new QVBoxLayout( this ); |
281 | lay->setSpacing( 3 ); | 281 | lay->setSpacing( 3 ); |
282 | lay->setMargin( 3 ); | 282 | lay->setMargin( 3 ); |
283 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 283 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
284 | lay->addWidget( format ); | 284 | lay->addWidget( format ); |
285 | format->setExclusive ( true ) ; | 285 | format->setExclusive ( true ) ; |
286 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 286 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
287 | lay->addWidget( time ); time->setExclusive ( true ) ; | 287 | lay->addWidget( time ); time->setExclusive ( true ) ; |
288 | vcal = new QRadioButton(" vCalendar ", format ); | 288 | vcal = new QRadioButton(" vCalendar ", format ); |
289 | ical = new QRadioButton(" iCalendar ", format ); | 289 | ical = new QRadioButton(" iCalendar ", format ); |
290 | vcal->setChecked( true ); | 290 | vcal->setChecked( true ); |
291 | tz = new QRadioButton(i18n(" With timezone "), time ); | 291 | tz = new QRadioButton(i18n(" With timezone "), time ); |
292 | local = new QRadioButton(i18n(" Local time "), time ); | 292 | local = new QRadioButton(i18n(" Local time "), time ); |
293 | tz->setChecked( true ); | 293 | tz->setChecked( true ); |
294 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 294 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
295 | lay->addWidget( ok ); | 295 | lay->addWidget( ok ); |
296 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 296 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
297 | lay->addWidget( cancel ); | 297 | lay->addWidget( cancel ); |
298 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 298 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
299 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 299 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
300 | resize( 200, 200 ); | 300 | resize( 200, 200 ); |
301 | } | 301 | } |
302 | 302 | ||
303 | bool beamVcal() { return vcal->isChecked(); } | 303 | bool beamVcal() { return vcal->isChecked(); } |
304 | bool beamLocal() { return local->isChecked(); } | 304 | bool beamLocal() { return local->isChecked(); } |
305 | private: | 305 | private: |
306 | QRadioButton* vcal, *ical, *local, *tz; | 306 | QRadioButton* vcal, *ical, *local, *tz; |
307 | }; | 307 | }; |
308 | class KOCatPrefs : public QDialog | 308 | class KOCatPrefs : public QDialog |
309 | { | 309 | { |
310 | public: | 310 | public: |
311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
312 | QDialog( parent, name, true ) | 312 | QDialog( parent, name, true ) |
313 | { | 313 | { |
314 | setCaption( i18n("Manage new Categories") ); | 314 | setCaption( i18n("Manage new Categories") ); |
315 | QVBoxLayout* lay = new QVBoxLayout( this ); | 315 | QVBoxLayout* lay = new QVBoxLayout( this ); |
316 | lay->setSpacing( 3 ); | 316 | lay->setSpacing( 3 ); |
317 | lay->setMargin( 3 ); | 317 | lay->setMargin( 3 ); |
318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); | 318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); |
319 | lay->addWidget( lab ); | 319 | lay->addWidget( lab ); |
320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
321 | lay->addWidget( format ); | 321 | lay->addWidget( format ); |
322 | format->setExclusive ( true ) ; | 322 | format->setExclusive ( true ) ; |
323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
325 | addCatBut->setChecked( true ); | 325 | addCatBut->setChecked( true ); |
326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); | 326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); |
327 | lay->addWidget( ok ); | 327 | lay->addWidget( ok ); |
328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
329 | lay->addWidget( cancel ); | 329 | lay->addWidget( cancel ); |
330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
332 | resize( 200, 200 ); | 332 | resize( 200, 200 ); |
333 | } | 333 | } |
334 | 334 | ||
335 | bool addCat() { return addCatBut->isChecked(); } | 335 | bool addCat() { return addCatBut->isChecked(); } |
336 | private: | 336 | private: |
337 | QRadioButton* addCatBut; | 337 | QRadioButton* addCatBut; |
338 | }; | 338 | }; |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
342 | CalendarView::CalendarView( CalendarResources *calendar, | 342 | CalendarView::CalendarView( CalendarResources *calendar, |
343 | QWidget *parent, const char *name ) | 343 | QWidget *parent, const char *name ) |
344 | : CalendarViewBase( parent, name ), | 344 | : CalendarViewBase( parent, name ), |
345 | mCalendar( calendar ), | 345 | mCalendar( calendar ), |
346 | mResourceManager( calendar->resourceManager() ) | 346 | mResourceManager( calendar->resourceManager() ) |
347 | { | 347 | { |
348 | 348 | ||
349 | mEventEditor = 0; | 349 | mEventEditor = 0; |
350 | mTodoEditor = 0; | 350 | mTodoEditor = 0; |
351 | 351 | ||
352 | init(); | 352 | init(); |
353 | } | 353 | } |
354 | 354 | ||
355 | CalendarView::CalendarView( Calendar *calendar, | 355 | CalendarView::CalendarView( Calendar *calendar, |
356 | QWidget *parent, const char *name ) | 356 | QWidget *parent, const char *name ) |
357 | : CalendarViewBase( parent, name ), | 357 | : CalendarViewBase( parent, name ), |
358 | mCalendar( calendar ), | 358 | mCalendar( calendar ), |
359 | mResourceManager( 0 ) | 359 | mResourceManager( 0 ) |
360 | { | 360 | { |
361 | 361 | ||
362 | mEventEditor = 0; | 362 | mEventEditor = 0; |
363 | mTodoEditor = 0; | 363 | mTodoEditor = 0; |
364 | init(); | 364 | init(); |
365 | } | 365 | } |
366 | 366 | ||
367 | void CalendarView::init() | 367 | void CalendarView::init() |
368 | { | 368 | { |
369 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 369 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
370 | //setFocusPolicy ( NoFocus ); | 370 | setFocusPolicy (NoFocus ); |
371 | mViewerCallerIsSearchDialog = false; | 371 | mViewerCallerIsSearchDialog = false; |
372 | mBlockShowDates = false; | 372 | mBlockShowDates = false; |
373 | 373 | ||
374 | mDatePickerMode = 0; | 374 | mDatePickerMode = 0; |
375 | mCurrentSyncDevice = ""; | 375 | mCurrentSyncDevice = ""; |
376 | mViewManager = new KOViewManager( this ); | 376 | mViewManager = new KOViewManager( this ); |
377 | mDialogManager = new KODialogManager( this ); | 377 | mDialogManager = new KODialogManager( this ); |
378 | mEventViewerDialog = 0; | 378 | mEventViewerDialog = 0; |
379 | mModified = false; | 379 | mModified = false; |
380 | mReadOnly = false; | 380 | mReadOnly = false; |
381 | mSelectedIncidence = 0; | 381 | mSelectedIncidence = 0; |
382 | mCalPrinter = 0; | 382 | mCalPrinter = 0; |
383 | mFilters.setAutoDelete(true); | 383 | mFilters.setAutoDelete(true); |
384 | 384 | ||
385 | mCalendar->registerObserver( this ); | 385 | mCalendar->registerObserver( this ); |
386 | // TODO: Make sure that view is updated, when calendar is changed. | 386 | // TODO: Make sure that view is updated, when calendar is changed. |
387 | 387 | ||
388 | mStorage = new FileStorage( mCalendar ); | 388 | mStorage = new FileStorage( mCalendar ); |
389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
390 | 390 | ||
391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
392 | #ifndef KORG_NOSPLITTER | 392 | #ifndef KORG_NOSPLITTER |
393 | // create the main layout frames. | 393 | // create the main layout frames. |
394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
395 | topLayout->addWidget(mPanner); | 395 | topLayout->addWidget(mPanner); |
396 | 396 | ||
397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
398 | "CalendarView::LeftFrame"); | 398 | "CalendarView::LeftFrame"); |
399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
400 | 400 | ||
401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
402 | "CalendarView::DateNavigator" ); | 402 | "CalendarView::DateNavigator" ); |
403 | 403 | ||
404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
406 | mTodoList->setNavigator( mNavigator ); | 406 | mTodoList->setNavigator( mNavigator ); |
407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
408 | 408 | ||
409 | #ifdef KORG_NORESOURCEVIEW | 409 | #ifdef KORG_NORESOURCEVIEW |
410 | mResourceView = 0; | 410 | mResourceView = 0; |
411 | #else | 411 | #else |
412 | if ( mResourceManager ) { | 412 | if ( mResourceManager ) { |
413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
414 | mResourceView->updateView(); | 414 | mResourceView->updateView(); |
415 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 415 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
416 | SLOT( updateView() ) ); | 416 | SLOT( updateView() ) ); |
417 | } else { | 417 | } else { |
418 | mResourceView = 0; | 418 | mResourceView = 0; |
419 | } | 419 | } |
420 | #endif | 420 | #endif |
421 | QWidget *rightBox = new QWidget( mPanner ); | 421 | QWidget *rightBox = new QWidget( mPanner ); |
422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
423 | 423 | ||
424 | mRightFrame = new QWidgetStack( rightBox ); | 424 | mRightFrame = new QWidgetStack( rightBox ); |
425 | rightLayout->addWidget( mRightFrame, 1 ); | 425 | rightLayout->addWidget( mRightFrame, 1 ); |
426 | 426 | ||
427 | mLeftFrame = mLeftSplitter; | 427 | mLeftFrame = mLeftSplitter; |
428 | #else | 428 | #else |
429 | //QWidget *mainBox = new QWidget( this ); | 429 | //QWidget *mainBox = new QWidget( this ); |
430 | //QWidget *leftFrame = new QWidget( mainBox ); | 430 | //QWidget *leftFrame = new QWidget( mainBox ); |
431 | //QBoxLayout * mainBoxLayout; | 431 | //QBoxLayout * mainBoxLayout; |
432 | if ( KOPrefs::instance()->mVerticalScreen ) { | 432 | if ( KOPrefs::instance()->mVerticalScreen ) { |
433 | //mainBoxLayout = new QVBoxLayout(mainBox); | 433 | //mainBoxLayout = new QVBoxLayout(mainBox); |
434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
435 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 435 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
436 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 436 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
437 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 437 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
438 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 438 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
439 | } else { | 439 | } else { |
440 | //mainBoxLayout = new QHBoxLayout(mainBox); | 440 | //mainBoxLayout = new QHBoxLayout(mainBox); |
441 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 441 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
442 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 442 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
443 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 443 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
444 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 444 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
445 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 445 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
446 | } | 446 | } |
447 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 447 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
448 | //QBoxLayout * leftFrameLayout; | 448 | //QBoxLayout * leftFrameLayout; |
449 | topLayout->addWidget( mMainFrame ); | 449 | topLayout->addWidget( mMainFrame ); |
450 | #ifdef DESKTOP_VERSION | 450 | #ifdef DESKTOP_VERSION |
451 | mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); | 451 | mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); |
452 | topLayout->addWidget( mDateScrollBar ); | 452 | topLayout->addWidget( mDateScrollBar ); |
453 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); | 453 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); |
454 | if ( QApplication::desktop()->width() < 800 ) | 454 | if ( QApplication::desktop()->width() < 800 ) |
455 | mDateScrollBar->hide(); | 455 | mDateScrollBar->hide(); |
456 | #endif | 456 | #endif |
457 | //mainBoxLayout->addWidget (mLeftFrame); | 457 | //mainBoxLayout->addWidget (mLeftFrame); |
458 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 458 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
459 | "CalendarView::DateNavigator" ); | 459 | "CalendarView::DateNavigator" ); |
460 | #if 0 | 460 | #if 0 |
461 | // FIXME | 461 | // FIXME |
462 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 462 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
463 | "CalendarView::DateNavigator", QDate::currentDate()); | 463 | "CalendarView::DateNavigator", QDate::currentDate()); |
464 | #endif | 464 | #endif |
465 | // mDateNavigator->blockSignals( true ); | 465 | // mDateNavigator->blockSignals( true ); |
466 | //leftFrameLayout->addWidget( mDateNavigator ); | 466 | //leftFrameLayout->addWidget( mDateNavigator ); |
467 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 467 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
468 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 468 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
469 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 469 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
470 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); | 470 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
471 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 471 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
472 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); | 472 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); |
473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
474 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); | 474 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); |
475 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | 475 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); |
476 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | 476 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); |
477 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | 477 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); |
478 | connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); | 478 | connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); |
479 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); | 479 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); |
480 | 480 | ||
481 | mTodoList->setNavigator( mNavigator ); | 481 | mTodoList->setNavigator( mNavigator ); |
482 | #if 0 | 482 | #if 0 |
483 | if ( QApplication::desktop()->width() < 480 ) { | 483 | if ( QApplication::desktop()->width() < 480 ) { |
484 | leftFrameLayout->addWidget(mFilterView); | 484 | leftFrameLayout->addWidget(mFilterView); |
485 | leftFrameLayout->addWidget(mTodoList, 2 ); | 485 | leftFrameLayout->addWidget(mTodoList, 2 ); |
486 | 486 | ||
487 | } else { | 487 | } else { |
488 | leftFrameLayout->addWidget(mTodoList,2 ); | 488 | leftFrameLayout->addWidget(mTodoList,2 ); |
489 | leftFrameLayout->addWidget(mFilterView ); | 489 | leftFrameLayout->addWidget(mFilterView ); |
490 | } | 490 | } |
491 | #endif | 491 | #endif |
492 | mFilterView->hide(); | 492 | mFilterView->hide(); |
493 | mCalEditView->hide(); | 493 | mCalEditView->hide(); |
494 | QWidget *rightBox = new QWidget( mMainFrame ); | 494 | QWidget *rightBox = new QWidget( mMainFrame ); |
495 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 495 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
496 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 496 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
497 | mRightFrame = new QWidgetStack( rightBox ); | 497 | mRightFrame = new QWidgetStack( rightBox ); |
498 | rightLayout->addWidget( mRightFrame, 10 ); | 498 | rightLayout->addWidget( mRightFrame, 10 ); |
499 | 499 | ||
500 | //mLeftFrame = (QWidget *)leftFrame; | 500 | //mLeftFrame = (QWidget *)leftFrame; |
501 | if ( KOPrefs::instance()->mVerticalScreen ) { | 501 | if ( KOPrefs::instance()->mVerticalScreen ) { |
502 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 502 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
503 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 503 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
504 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 504 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
505 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 505 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
506 | } else { | 506 | } else { |
507 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 507 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
508 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 508 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
509 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 509 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
510 | } | 510 | } |
511 | if ( !KOPrefs::instance()->mShowDateNavigator) | 511 | if ( !KOPrefs::instance()->mShowDateNavigator) |
512 | mDateNavigator->hide(); | 512 | mDateNavigator->hide(); |
513 | //qDebug("Calendarview Size %d %d ", width(), height()); | 513 | //qDebug("Calendarview Size %d %d ", width(), height()); |
514 | #endif | 514 | #endif |
515 | 515 | ||
516 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 516 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
517 | SLOT( showDates( const KCal::DateList & ) ) ); | 517 | SLOT( showDates( const KCal::DateList & ) ) ); |
518 | 518 | ||
519 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 519 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
520 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 520 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
521 | 521 | ||
522 | 522 | ||
523 | 523 | ||
524 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 524 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
525 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 525 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
526 | 526 | ||
527 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 527 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
528 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 528 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
529 | 529 | ||
530 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 530 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
531 | mNavigator, SLOT( selectPreviousYear() ) ); | 531 | mNavigator, SLOT( selectPreviousYear() ) ); |
532 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 532 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
533 | mNavigator, SLOT( selectNextYear() ) ); | 533 | mNavigator, SLOT( selectNextYear() ) ); |
534 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 534 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
535 | mNavigator, SLOT( selectPreviousMonth() ) ); | 535 | mNavigator, SLOT( selectPreviousMonth() ) ); |
536 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 536 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
537 | mNavigator, SLOT( selectNextMonth() ) ); | 537 | mNavigator, SLOT( selectNextMonth() ) ); |
538 | 538 | ||
539 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 539 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
540 | mNavigator, SLOT( selectPrevious() ) ); | 540 | mNavigator, SLOT( selectPrevious() ) ); |
541 | connect( mDateNavigator, SIGNAL( goNext() ), | 541 | connect( mDateNavigator, SIGNAL( goNext() ), |
542 | mNavigator, SLOT( selectNext() ) ); | 542 | mNavigator, SLOT( selectNext() ) ); |
543 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 543 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
544 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 544 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
545 | 545 | ||
546 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 546 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
547 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 547 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
548 | #if 0 | 548 | #if 0 |
549 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 549 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
550 | SLOT( incidenceAdded( Incidence *) ) ); | 550 | SLOT( incidenceAdded( Incidence *) ) ); |
551 | #endif | 551 | #endif |
552 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 552 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
553 | 553 | ||
554 | connect( this, SIGNAL( configChanged() ), | 554 | connect( this, SIGNAL( configChanged() ), |
555 | mDateNavigator, SLOT( updateConfig() ) ); | 555 | mDateNavigator, SLOT( updateConfig() ) ); |
556 | 556 | ||
557 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 557 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
558 | SLOT( newTodo() ) ); | 558 | SLOT( newTodo() ) ); |
559 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 559 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
560 | SLOT( newSubTodo( Todo * ) ) ); | 560 | SLOT( newSubTodo( Todo * ) ) ); |
561 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 561 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
562 | SLOT( editTodo( Todo * ) ) ); | 562 | SLOT( editTodo( Todo * ) ) ); |
563 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 563 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
564 | SLOT( showTodo( Todo *) ) ); | 564 | SLOT( showTodo( Todo *) ) ); |
565 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 565 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
566 | SLOT( deleteTodo( Todo *) ) ); | 566 | SLOT( deleteTodo( Todo *) ) ); |
567 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 567 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
568 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 568 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
569 | SLOT( purgeCompleted() ) ); | 569 | SLOT( purgeCompleted() ) ); |
570 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 570 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
571 | SIGNAL( todoModified( Todo *, int ) ) ); | 571 | SIGNAL( todoModified( Todo *, int ) ) ); |
572 | 572 | ||
573 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 573 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
574 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 574 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
575 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 575 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
576 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 576 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
577 | 577 | ||
578 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 578 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
579 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 579 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
580 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 580 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
581 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 581 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
582 | 582 | ||
583 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 583 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
584 | this, SLOT ( todo_unsub( Todo * ) ) ); | 584 | this, SLOT ( todo_unsub( Todo * ) ) ); |
585 | 585 | ||
586 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 586 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
587 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 587 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
588 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 588 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
589 | SLOT( updateTodo( Todo *, int ) ) ); | 589 | SLOT( updateTodo( Todo *, int ) ) ); |
590 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 590 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
591 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 591 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
592 | 592 | ||
593 | 593 | ||
594 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 594 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
595 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 595 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
596 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 596 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
597 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 597 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
598 | 598 | ||
599 | 599 | ||
600 | 600 | ||
601 | 601 | ||
602 | 602 | ||
603 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 603 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
604 | SLOT(checkClipboard())); | 604 | SLOT(checkClipboard())); |
605 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 605 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
606 | SLOT( processTodoListSelection( Incidence * ) ) ); | 606 | SLOT( processTodoListSelection( Incidence * ) ) ); |
607 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 607 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
608 | 608 | ||
609 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 609 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
610 | 610 | ||
611 | mDateFrame = new QVBox(0,0,WType_Popup); | 611 | mDateFrame = new QVBox(0,0,WType_Popup); |
612 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 612 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
613 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 613 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
614 | mDateFrame->setLineWidth(3); | 614 | mDateFrame->setLineWidth(3); |
615 | mDateFrame->hide(); | 615 | mDateFrame->hide(); |
616 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 616 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
617 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 617 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
618 | 618 | ||
619 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 619 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
620 | 620 | ||
621 | mEventEditor = mDialogManager->getEventEditor(); | 621 | mEventEditor = mDialogManager->getEventEditor(); |
622 | mTodoEditor = mDialogManager->getTodoEditor(); | 622 | mTodoEditor = mDialogManager->getTodoEditor(); |
623 | 623 | ||
624 | mFlagEditDescription = false; | 624 | mFlagEditDescription = false; |
625 | 625 | ||
626 | mSuspendTimer = new QTimer( this ); | 626 | mSuspendTimer = new QTimer( this ); |
627 | mAlarmTimer = new QTimer( this ); | 627 | mAlarmTimer = new QTimer( this ); |
628 | mRecheckAlarmTimer = new QTimer( this ); | 628 | mRecheckAlarmTimer = new QTimer( this ); |
629 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 629 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
630 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 630 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
631 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 631 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
632 | mAlarmDialog = new AlarmDialog( this ); | 632 | mAlarmDialog = new AlarmDialog( this ); |
633 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 633 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
634 | mAlarmDialog->setServerNotification( false ); | 634 | mAlarmDialog->setServerNotification( false ); |
635 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 635 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
636 | 636 | ||
637 | 637 | ||
638 | #ifndef DESKTOP_VERSION | 638 | #ifndef DESKTOP_VERSION |
639 | //US listen for arriving address resultsets | 639 | //US listen for arriving address resultsets |
640 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 640 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
641 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 641 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
642 | #endif | 642 | #endif |
643 | mDateNavigator->setCalendar( mCalendar ); | 643 | mDateNavigator->setCalendar( mCalendar ); |
644 | } | 644 | } |
645 | 645 | ||
646 | 646 | ||
647 | CalendarView::~CalendarView() | 647 | CalendarView::~CalendarView() |
648 | { | 648 | { |
649 | // kdDebug() << "~CalendarView()" << endl; | 649 | // kdDebug() << "~CalendarView()" << endl; |
650 | //qDebug("CalendarView::~CalendarView() "); | 650 | //qDebug("CalendarView::~CalendarView() "); |
651 | delete mDialogManager; | 651 | delete mDialogManager; |
652 | delete mViewManager; | 652 | delete mViewManager; |
653 | delete mStorage; | 653 | delete mStorage; |
654 | delete mDateFrame ; | 654 | delete mDateFrame ; |
655 | delete mEventViewerDialog; | 655 | delete mEventViewerDialog; |
656 | //kdDebug() << "~CalendarView() done" << endl; | 656 | //kdDebug() << "~CalendarView() done" << endl; |
657 | } | 657 | } |
658 | 658 | ||
659 | void CalendarView::slotResetFocus() | ||
660 | { | ||
661 | qDebug(" CalendarView::slotResetFocus() %x", qApp->focusWidget()); | ||
662 | |||
663 | } | ||
664 | 659 | ||
665 | void CalendarView::nextConflict( bool all, bool allday ) | 660 | void CalendarView::nextConflict( bool all, bool allday ) |
666 | { | 661 | { |
667 | 662 | ||
668 | QPtrList<Event> testlist = mCalendar->events(); | 663 | QPtrList<Event> testlist = mCalendar->events(); |
669 | Event * test = testlist.first(); | 664 | Event * test = testlist.first(); |
670 | while ( test ) { | 665 | while ( test ) { |
671 | test->setTagged( false ); | 666 | test->setTagged( false ); |
672 | test = testlist.next(); | 667 | test = testlist.next(); |
673 | } | 668 | } |
674 | QTime st ( 0,0,0); | 669 | QTime st ( 0,0,0); |
675 | if ( mViewManager->currentView() == mViewManager->agendaView() ) | 670 | if ( mViewManager->currentView() == mViewManager->agendaView() ) |
676 | st = mViewManager->agendaView()->agenda()->getEndTime(); | 671 | st = mViewManager->agendaView()->agenda()->getEndTime(); |
677 | //qDebug("time %s ", st.toString().latin1()); | 672 | //qDebug("time %s ", st.toString().latin1()); |
678 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); | 673 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); |
679 | QDateTime conflict; | 674 | QDateTime conflict; |
680 | QDateTime retVal; | 675 | QDateTime retVal; |
681 | bool found = false; | 676 | bool found = false; |
682 | Event * cE = 0; | 677 | Event * cE = 0; |
683 | Event * cE2 = 0; | 678 | Event * cE2 = 0; |
684 | QPtrList<Event> testlist2 = testlist; | 679 | QPtrList<Event> testlist2 = testlist; |
685 | test = testlist.first(); | 680 | test = testlist.first(); |
686 | bool skip = false; | 681 | bool skip = false; |
687 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 682 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
688 | while ( test ) { | 683 | while ( test ) { |
689 | qApp->processEvents(); | 684 | qApp->processEvents(); |
690 | skip = false; | 685 | skip = false; |
691 | if ( !all ) skip = ( allday != test->doesFloat() ); | 686 | if ( !all ) skip = ( allday != test->doesFloat() ); |
692 | if ( !skip ) { | 687 | if ( !skip ) { |
693 | Event * test2 = testlist2.first(); | 688 | Event * test2 = testlist2.first(); |
694 | while ( test2 ) { | 689 | while ( test2 ) { |
695 | skip = false; | 690 | skip = false; |
696 | if ( !all ) skip = ( allday != test2->doesFloat() ); | 691 | if ( !all ) skip = ( allday != test2->doesFloat() ); |
697 | if ( !skip ) { | 692 | if ( !skip ) { |
698 | if ( !test2->isTagged() ) { | 693 | if ( !test2->isTagged() ) { |
699 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { | 694 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { |
700 | //qDebug("overlap "); | 695 | //qDebug("overlap "); |
701 | if ( ! found ) { | 696 | if ( ! found ) { |
702 | if ( retVal >= startDT ) { | 697 | if ( retVal >= startDT ) { |
703 | conflict = retVal; | 698 | conflict = retVal; |
704 | cE = test; | 699 | cE = test; |
705 | cE2 = test2; | 700 | cE2 = test2; |
706 | found = true; | 701 | found = true; |
707 | } | 702 | } |
708 | } else { | 703 | } else { |
709 | if ( retVal >= startDT && retVal < conflict ) { | 704 | if ( retVal >= startDT && retVal < conflict ) { |
710 | conflict = retVal; | 705 | conflict = retVal; |
711 | cE = test; | 706 | cE = test; |
712 | cE2 = test2; | 707 | cE2 = test2; |
713 | } | 708 | } |
714 | } | 709 | } |
715 | } | 710 | } |
716 | } | 711 | } |
717 | } | 712 | } |
718 | test2 = testlist2.next(); | 713 | test2 = testlist2.next(); |
719 | } | 714 | } |
720 | } | 715 | } |
721 | test->setTagged( true ); | 716 | test->setTagged( true ); |
722 | test = testlist.next(); | 717 | test = testlist.next(); |
723 | } | 718 | } |
724 | if ( found ) { | 719 | if ( found ) { |
725 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 720 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
726 | mViewManager->showDayView(); | 721 | mViewManager->showDayView(); |
727 | mNavigator->slotDaySelect( conflict.date() ); | 722 | mNavigator->slotDaySelect( conflict.date() ); |
728 | int hour = conflict.time().hour(); | 723 | int hour = conflict.time().hour(); |
729 | mViewManager->agendaView()->setStartHour( hour ); | 724 | mViewManager->agendaView()->setStartHour( hour ); |
730 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); | 725 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); |
731 | return; | 726 | return; |
732 | } | 727 | } |
733 | 728 | ||
734 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 729 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
735 | qDebug("No conflict found "); | 730 | qDebug("No conflict found "); |
736 | return; | 731 | return; |
737 | } | 732 | } |
738 | 733 | ||
739 | void CalendarView::conflictAll() | 734 | void CalendarView::conflictAll() |
740 | { | 735 | { |
741 | nextConflict ( true, true ); | 736 | nextConflict ( true, true ); |
742 | } | 737 | } |
743 | void CalendarView::conflictAllday() | 738 | void CalendarView::conflictAllday() |
744 | { | 739 | { |
745 | nextConflict ( false, true ); | 740 | nextConflict ( false, true ); |
746 | } | 741 | } |
747 | void CalendarView::conflictNotAll() | 742 | void CalendarView::conflictNotAll() |
748 | { | 743 | { |
749 | nextConflict ( false, false ); | 744 | nextConflict ( false, false ); |
750 | } | 745 | } |
751 | 746 | ||
752 | void CalendarView::setCalReadOnly( int id, bool readO ) | 747 | void CalendarView::setCalReadOnly( int id, bool readO ) |
753 | { | 748 | { |
754 | if ( readO ) { | 749 | if ( readO ) { |
755 | emit save(); | 750 | emit save(); |
756 | } | 751 | } |
757 | mCalendar->setReadOnly( id, readO ); | 752 | mCalendar->setReadOnly( id, readO ); |
758 | } | 753 | } |
759 | void CalendarView::setScrollBarStep(int val ) | 754 | void CalendarView::setScrollBarStep(int val ) |
760 | { | 755 | { |
761 | #ifdef DESKTOP_VERSION | 756 | #ifdef DESKTOP_VERSION |
762 | mDateScrollBar->setLineStep ( val ); | 757 | mDateScrollBar->setLineStep ( val ); |
763 | #endif | 758 | #endif |
764 | } | 759 | } |
765 | void CalendarView::scrollBarValue(int val ) | 760 | void CalendarView::scrollBarValue(int val ) |
766 | { | 761 | { |
767 | #ifdef DESKTOP_VERSION | 762 | #ifdef DESKTOP_VERSION |
768 | if ( QApplication::desktop()->width() < 800 ) return; | 763 | if ( QApplication::desktop()->width() < 800 ) return; |
769 | static bool block = false; | 764 | static bool block = false; |
770 | if ( block ) return; | 765 | if ( block ) return; |
771 | block = true; | 766 | block = true; |
772 | int count = mNavigator->selectedDates().count(); | 767 | int count = mNavigator->selectedDates().count(); |
773 | int day = mNavigator->selectedDates().first().dayOfYear(); | 768 | int day = mNavigator->selectedDates().first().dayOfYear(); |
774 | int stepdays = val; | 769 | int stepdays = val; |
775 | if ( mDateScrollBar->lineStep () <= count ) { | 770 | if ( mDateScrollBar->lineStep () <= count ) { |
776 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 771 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
777 | //qDebug("VAL %d ",val ); | 772 | //qDebug("VAL %d ",val ); |
778 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 773 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
779 | stepdays = day+stepdays; | 774 | stepdays = day+stepdays; |
780 | if ( stepdays < 0 ) stepdays = 0; | 775 | if ( stepdays < 0 ) stepdays = 0; |
781 | } | 776 | } |
782 | if ( stepdays == day ) { | 777 | if ( stepdays == day ) { |
783 | block = false; | 778 | block = false; |
784 | return; | 779 | return; |
785 | } | 780 | } |
786 | int year = mNavigator->selectedDates().first().year(); | 781 | int year = mNavigator->selectedDates().first().year(); |
787 | QDate d ( year,1,1 ); | 782 | QDate d ( year,1,1 ); |
788 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); | 783 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); |
789 | block = false; | 784 | block = false; |
790 | #endif | 785 | #endif |
791 | 786 | ||
792 | } | 787 | } |
793 | void CalendarView::updateView(const QDate &start, const QDate &end) | 788 | void CalendarView::updateView(const QDate &start, const QDate &end) |
794 | { | 789 | { |
795 | #ifdef DESKTOP_VERSION | 790 | #ifdef DESKTOP_VERSION |
796 | if ( ! mDateScrollBar->draggingSlider () ) { | 791 | if ( ! mDateScrollBar->draggingSlider () ) { |
797 | int dof = start.dayOfYear(); | 792 | int dof = start.dayOfYear(); |
798 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); | 793 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); |
799 | if ( dof != mDateScrollBar->value() ) { | 794 | if ( dof != mDateScrollBar->value() ) { |
800 | mDateScrollBar->blockSignals( true ); | 795 | mDateScrollBar->blockSignals( true ); |
801 | mDateScrollBar->setValue( start.dayOfYear()); | 796 | mDateScrollBar->setValue( start.dayOfYear()); |
802 | mDateScrollBar->blockSignals( false ); | 797 | mDateScrollBar->blockSignals( false ); |
803 | } | 798 | } |
804 | } | 799 | } |
805 | #endif | 800 | #endif |
806 | mTodoList->updateView(); | 801 | mTodoList->updateView(); |
807 | mViewManager->updateView(start, end); | 802 | mViewManager->updateView(start, end); |
808 | //mDateNavigator->updateView(); | 803 | //mDateNavigator->updateView(); |
809 | } | 804 | } |
810 | 805 | ||
811 | 806 | ||
812 | 807 | ||
813 | void CalendarView::checkFiles() | 808 | void CalendarView::checkFiles() |
814 | { | 809 | { |
815 | QString message; | 810 | QString message; |
816 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 811 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
817 | KopiCalendarFile * cal = calendars.first(); | 812 | KopiCalendarFile * cal = calendars.first(); |
818 | while ( cal ) { | 813 | while ( cal ) { |
819 | if ( cal->mErrorOnLoad ) { | 814 | if ( cal->mErrorOnLoad ) { |
820 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; | 815 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; |
821 | } | 816 | } |
822 | cal = calendars.next(); | 817 | cal = calendars.next(); |
823 | } | 818 | } |
824 | if ( !message.isEmpty() ) { | 819 | if ( !message.isEmpty() ) { |
825 | message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); | 820 | message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); |
826 | KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); | 821 | KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); |
827 | } | 822 | } |
828 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); | 823 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); |
829 | } | 824 | } |
830 | void CalendarView::checkAlarms() | 825 | void CalendarView::checkAlarms() |
831 | { | 826 | { |
832 | 827 | ||
833 | 828 | ||
834 | KConfig *config = KOGlobals::config(); | 829 | KConfig *config = KOGlobals::config(); |
835 | config->setGroup( "AppRun" ); | 830 | config->setGroup( "AppRun" ); |
836 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 831 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
837 | int daysto = dt.daysTo( QDate::currentDate() ); | 832 | int daysto = dt.daysTo( QDate::currentDate() ); |
838 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 833 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
839 | dt = dt.addDays( days ); | 834 | dt = dt.addDays( days ); |
840 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 835 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
841 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 836 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
842 | //qDebug("KO: Reading program stop %d ", secs); | 837 | //qDebug("KO: Reading program stop %d ", secs); |
843 | //secs -= ( 3600 * 24*3 ); // debug only | 838 | //secs -= ( 3600 * 24*3 ); // debug only |
844 | QDateTime latest = dt.addSecs ( secs ); | 839 | QDateTime latest = dt.addSecs ( secs ); |
845 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 840 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
846 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 841 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
847 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 842 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
848 | QPtrList<Incidence> al; | 843 | QPtrList<Incidence> al; |
849 | Incidence* inL = el.first(); | 844 | Incidence* inL = el.first(); |
850 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 845 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
851 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 846 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
852 | while ( inL ) { | 847 | while ( inL ) { |
853 | bool ok = false; | 848 | bool ok = false; |
854 | int offset = 0; | 849 | int offset = 0; |
855 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 850 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
856 | if ( ok ) { | 851 | if ( ok ) { |
857 | //qDebug("OK %s",next.toString().latin1()); | 852 | //qDebug("OK %s",next.toString().latin1()); |
858 | if ( next < cur ) { | 853 | if ( next < cur ) { |
859 | al.append( inL ); | 854 | al.append( inL ); |
860 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 855 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
861 | } | 856 | } |
862 | } | 857 | } |
863 | inL = el.next(); | 858 | inL = el.next(); |
864 | } | 859 | } |
865 | if ( al.count() ) { | 860 | if ( al.count() ) { |
866 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 861 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
867 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 862 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
868 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 863 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
869 | lay->setSpacing( 0 ); | 864 | lay->setSpacing( 0 ); |
870 | lay->setMargin( 0 ); | 865 | lay->setMargin( 0 ); |
871 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 866 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
872 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 867 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
873 | lay->addWidget( matb ); | 868 | lay->addWidget( matb ); |
874 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 869 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
875 | int wid = 210; | 870 | int wid = 210; |
876 | int x = QApplication::desktop()->width() - wid - 7; | 871 | int x = QApplication::desktop()->width() - wid - 7; |
877 | int y = QApplication::desktop()->height() - wid - 70; | 872 | int y = QApplication::desktop()->height() - wid - 70; |
878 | dia->setGeometry ( x,y,wid,wid); | 873 | dia->setGeometry ( x,y,wid,wid); |
879 | } else { | 874 | } else { |
880 | int si = 220; | 875 | int si = 220; |
881 | if ( QApplication::desktop()->width() > 470 ) | 876 | if ( QApplication::desktop()->width() > 470 ) |
882 | si = 400; | 877 | si = 400; |
883 | dia->resize(si,si/2); | 878 | dia->resize(si,si/2); |
884 | } | 879 | } |
885 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 880 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
886 | dia->show(); | 881 | dia->show(); |
887 | 882 | ||
888 | } | 883 | } |
889 | } | 884 | } |
890 | void CalendarView::showDay( QDate d ) | 885 | void CalendarView::showDay( QDate d ) |
891 | { | 886 | { |
892 | dateNavigator()->blockSignals( true ); | 887 | dateNavigator()->blockSignals( true ); |
893 | dateNavigator()->selectDate( d ); | 888 | dateNavigator()->selectDate( d ); |
894 | dateNavigator()->blockSignals( false ); | 889 | dateNavigator()->blockSignals( false ); |
895 | mViewManager->showDayView(); | 890 | mViewManager->showDayView(); |
896 | //dateNavigator()->selectDate( d ); | 891 | //dateNavigator()->selectDate( d ); |
897 | } | 892 | } |
898 | void CalendarView::timerAlarm() | 893 | void CalendarView::timerAlarm() |
899 | { | 894 | { |
900 | //qDebug("CalendarView::timerAlarm() "); | 895 | //qDebug("CalendarView::timerAlarm() "); |
901 | computeAlarm(mAlarmNotification ); | 896 | computeAlarm(mAlarmNotification ); |
902 | } | 897 | } |
903 | 898 | ||
904 | void CalendarView::suspendAlarm() | 899 | void CalendarView::suspendAlarm() |
905 | { | 900 | { |
906 | //qDebug(" CalendarView::suspendAlarm() "); | 901 | //qDebug(" CalendarView::suspendAlarm() "); |
907 | computeAlarm(mSuspendAlarmNotification ); | 902 | computeAlarm(mSuspendAlarmNotification ); |
908 | 903 | ||
909 | } | 904 | } |
910 | 905 | ||
911 | void CalendarView::startAlarm( QString mess , QString filename) | 906 | void CalendarView::startAlarm( QString mess , QString filename) |
912 | { | 907 | { |
913 | 908 | ||
914 | topLevelWidget()->showNormal(); | 909 | topLevelWidget()->showNormal(); |
915 | topLevelWidget()->setActiveWindow(); | 910 | topLevelWidget()->setActiveWindow(); |
916 | topLevelWidget()->raise(); | 911 | topLevelWidget()->raise(); |
917 | 912 | ||
918 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 913 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
919 | QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); | 914 | QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); |
920 | 915 | ||
921 | } | 916 | } |
922 | 917 | ||
923 | void CalendarView::checkNextTimerAlarm() | 918 | void CalendarView::checkNextTimerAlarm() |
924 | { | 919 | { |
925 | mCalendar->checkAlarmForIncidence( 0, true ); | 920 | mCalendar->checkAlarmForIncidence( 0, true ); |
926 | } | 921 | } |
927 | 922 | ||
928 | void CalendarView::computeAlarm( QString msg ) | 923 | void CalendarView::computeAlarm( QString msg ) |
929 | { | 924 | { |
930 | 925 | ||
931 | QString mess = msg; | 926 | QString mess = msg; |
932 | QString mAlarmMessage = mess.mid( 9 ); | 927 | QString mAlarmMessage = mess.mid( 9 ); |
933 | QString filename = MainWindow::resourcePath(); | 928 | QString filename = MainWindow::resourcePath(); |
934 | filename += "koalarm.wav"; | 929 | filename += "koalarm.wav"; |
935 | QString tempfilename; | 930 | QString tempfilename; |
936 | if ( mess.left( 13 ) == "suspend_alarm") { | 931 | if ( mess.left( 13 ) == "suspend_alarm") { |
937 | bool error = false; | 932 | bool error = false; |
938 | int len = mess.mid( 13 ).find("+++"); | 933 | int len = mess.mid( 13 ).find("+++"); |
939 | if ( len < 2 ) | 934 | if ( len < 2 ) |
940 | error = true; | 935 | error = true; |
941 | else { | 936 | else { |
942 | tempfilename = mess.mid( 13, len ); | 937 | tempfilename = mess.mid( 13, len ); |
943 | if ( !QFile::exists( tempfilename ) ) | 938 | if ( !QFile::exists( tempfilename ) ) |
944 | error = true; | 939 | error = true; |
945 | } | 940 | } |
946 | if ( ! error ) { | 941 | if ( ! error ) { |
947 | filename = tempfilename; | 942 | filename = tempfilename; |
948 | } | 943 | } |
949 | mAlarmMessage = mess.mid( 13+len+3 ); | 944 | mAlarmMessage = mess.mid( 13+len+3 ); |
950 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 945 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
951 | startAlarm( mAlarmMessage, filename); | 946 | startAlarm( mAlarmMessage, filename); |
952 | return; | 947 | return; |
953 | } | 948 | } |
954 | if ( mess.left( 11 ) == "timer_alarm") { | 949 | if ( mess.left( 11 ) == "timer_alarm") { |
955 | //mTimerTime = 0; | 950 | //mTimerTime = 0; |
956 | startAlarm( mess.mid( 11 ), filename ); | 951 | startAlarm( mess.mid( 11 ), filename ); |
957 | return; | 952 | return; |
958 | } | 953 | } |
959 | if ( mess.left( 10 ) == "proc_alarm") { | 954 | if ( mess.left( 10 ) == "proc_alarm") { |
960 | bool error = false; | 955 | bool error = false; |
961 | int len = mess.mid( 10 ).find("+++"); | 956 | int len = mess.mid( 10 ).find("+++"); |
962 | if ( len < 2 ) | 957 | if ( len < 2 ) |
963 | error = true; | 958 | error = true; |
964 | else { | 959 | else { |
965 | tempfilename = mess.mid( 10, len ); | 960 | tempfilename = mess.mid( 10, len ); |
966 | if ( !QFile::exists( tempfilename ) ) | 961 | if ( !QFile::exists( tempfilename ) ) |
967 | error = true; | 962 | error = true; |
968 | } | 963 | } |
969 | if ( error ) { | 964 | if ( error ) { |
970 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 965 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
971 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 966 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
972 | } else { | 967 | } else { |
973 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 968 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
974 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 969 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
975 | #ifndef _WIN32_ | 970 | #ifndef _WIN32_ |
976 | if ( vfork () == 0 ) { | 971 | if ( vfork () == 0 ) { |
977 | execl ( tempfilename.latin1(), 0 ); | 972 | execl ( tempfilename.latin1(), 0 ); |
978 | return; | 973 | return; |
979 | } | 974 | } |
980 | #else | 975 | #else |
981 | QProcess* p = new QProcess(); | 976 | QProcess* p = new QProcess(); |
982 | p->addArgument( tempfilename.latin1() ); | 977 | p->addArgument( tempfilename.latin1() ); |
983 | p->start(); | 978 | p->start(); |
984 | return; | 979 | return; |
985 | #endif | 980 | #endif |
986 | 981 | ||
987 | return; | 982 | return; |
988 | } | 983 | } |
989 | 984 | ||
990 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 985 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
991 | } | 986 | } |
992 | if ( mess.left( 11 ) == "audio_alarm") { | 987 | if ( mess.left( 11 ) == "audio_alarm") { |
993 | bool error = false; | 988 | bool error = false; |
994 | int len = mess.mid( 11 ).find("+++"); | 989 | int len = mess.mid( 11 ).find("+++"); |
995 | if ( len < 2 ) | 990 | if ( len < 2 ) |
996 | error = true; | 991 | error = true; |
997 | else { | 992 | else { |
998 | tempfilename = mess.mid( 11, len ); | 993 | tempfilename = mess.mid( 11, len ); |
999 | if ( !QFile::exists( tempfilename ) ) | 994 | if ( !QFile::exists( tempfilename ) ) |
1000 | error = true; | 995 | error = true; |
1001 | } | 996 | } |
1002 | if ( ! error ) { | 997 | if ( ! error ) { |
1003 | filename = tempfilename; | 998 | filename = tempfilename; |
1004 | } | 999 | } |
1005 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 1000 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
1006 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 1001 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
1007 | } | 1002 | } |
1008 | if ( mess.left( 9 ) == "cal_alarm") { | 1003 | if ( mess.left( 9 ) == "cal_alarm") { |
1009 | mAlarmMessage = mess.mid( 9 ) ; | 1004 | mAlarmMessage = mess.mid( 9 ) ; |
1010 | } | 1005 | } |
1011 | 1006 | ||
1012 | startAlarm( mAlarmMessage, filename ); | 1007 | startAlarm( mAlarmMessage, filename ); |
1013 | 1008 | ||
1014 | 1009 | ||
1015 | } | 1010 | } |
1016 | 1011 | ||
1017 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 1012 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
1018 | { | 1013 | { |
1019 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 1014 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
1020 | 1015 | ||
1021 | mSuspendAlarmNotification = noti; | 1016 | mSuspendAlarmNotification = noti; |
1022 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 1017 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
1023 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 1018 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
1024 | mSuspendTimer->start( ms , true ); | 1019 | mSuspendTimer->start( ms , true ); |
1025 | 1020 | ||
1026 | } | 1021 | } |
1027 | 1022 | ||
1028 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 1023 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
1029 | { | 1024 | { |
1030 | mNextAlarmDateTime = qdt; | 1025 | mNextAlarmDateTime = qdt; |
1031 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 1026 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
1032 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 1027 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
1033 | #ifndef DESKTOP_VERSION | 1028 | #ifndef DESKTOP_VERSION |
1034 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); | 1029 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); |
1035 | #endif | 1030 | #endif |
1036 | return; | 1031 | return; |
1037 | } | 1032 | } |
1038 | int maxSec; | 1033 | int maxSec; |
1039 | //maxSec = 5; //testing only | 1034 | //maxSec = 5; //testing only |
1040 | maxSec = 86400+3600; // one day+1hour | 1035 | maxSec = 86400+3600; // one day+1hour |
1041 | mAlarmNotification = noti; | 1036 | mAlarmNotification = noti; |
1042 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 1037 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
1043 | if ( sec > maxSec ) { | 1038 | if ( sec > maxSec ) { |
1044 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 1039 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
1045 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 1040 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
1046 | return; | 1041 | return; |
1047 | } else { | 1042 | } else { |
1048 | mRecheckAlarmTimer->stop(); | 1043 | mRecheckAlarmTimer->stop(); |
1049 | } | 1044 | } |
1050 | //qDebug("Alarm timer started with secs: %d ", sec); | 1045 | //qDebug("Alarm timer started with secs: %d ", sec); |
1051 | mAlarmTimer->start( sec *1000 , true ); | 1046 | mAlarmTimer->start( sec *1000 , true ); |
1052 | 1047 | ||
1053 | } | 1048 | } |
1054 | // called by mRecheckAlarmTimer to get next alarm | 1049 | // called by mRecheckAlarmTimer to get next alarm |
1055 | // we need this, because a QTimer has only a max range of 25 days | 1050 | // we need this, because a QTimer has only a max range of 25 days |
1056 | void CalendarView::recheckTimerAlarm() | 1051 | void CalendarView::recheckTimerAlarm() |
1057 | { | 1052 | { |
1058 | mAlarmTimer->stop(); | 1053 | mAlarmTimer->stop(); |
1059 | mRecheckAlarmTimer->stop(); | 1054 | mRecheckAlarmTimer->stop(); |
1060 | mCalendar->checkAlarmForIncidence( 0, true ); | 1055 | mCalendar->checkAlarmForIncidence( 0, true ); |
1061 | } | 1056 | } |
1062 | #ifndef DESKTOP_VERSION | 1057 | #ifndef DESKTOP_VERSION |
1063 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 1058 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
1064 | #else | 1059 | #else |
1065 | void CalendarView::removeAlarm(const QDateTime &, const QString & ) | 1060 | void CalendarView::removeAlarm(const QDateTime &, const QString & ) |
1066 | #endif | 1061 | #endif |
1067 | { | 1062 | { |
1068 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 1063 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
1069 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 1064 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
1070 | #ifndef DESKTOP_VERSION | 1065 | #ifndef DESKTOP_VERSION |
1071 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() ); | 1066 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() ); |
1072 | #endif | 1067 | #endif |
1073 | return; | 1068 | return; |
1074 | } | 1069 | } |
1075 | mAlarmTimer->stop(); | 1070 | mAlarmTimer->stop(); |
1076 | } | 1071 | } |
1077 | void CalendarView::selectWeekNum ( int num ) | 1072 | void CalendarView::selectWeekNum ( int num ) |
1078 | { | 1073 | { |
1079 | dateNavigator()->blockSignals( true ); | 1074 | dateNavigator()->blockSignals( true ); |
1080 | dateNavigator()->selectWeek( num ); | 1075 | dateNavigator()->selectWeek( num ); |
1081 | dateNavigator()->blockSignals( false ); | 1076 | dateNavigator()->blockSignals( false ); |
1082 | mViewManager->showWeekView(); | 1077 | mViewManager->showWeekView(); |
1083 | } | 1078 | } |
1084 | KOViewManager *CalendarView::viewManager() | 1079 | KOViewManager *CalendarView::viewManager() |
1085 | { | 1080 | { |
1086 | return mViewManager; | 1081 | return mViewManager; |
1087 | } | 1082 | } |
1088 | 1083 | ||
1089 | KODialogManager *CalendarView::dialogManager() | 1084 | KODialogManager *CalendarView::dialogManager() |
1090 | { | 1085 | { |
1091 | return mDialogManager; | 1086 | return mDialogManager; |
1092 | } | 1087 | } |
1093 | 1088 | ||
1094 | QDate CalendarView::startDate() | 1089 | QDate CalendarView::startDate() |
1095 | { | 1090 | { |
1096 | DateList dates = mNavigator->selectedDates(); | 1091 | DateList dates = mNavigator->selectedDates(); |
1097 | 1092 | ||
1098 | return dates.first(); | 1093 | return dates.first(); |
1099 | } | 1094 | } |
1100 | 1095 | ||
1101 | QDate CalendarView::endDate() | 1096 | QDate CalendarView::endDate() |
1102 | { | 1097 | { |
1103 | DateList dates = mNavigator->selectedDates(); | 1098 | DateList dates = mNavigator->selectedDates(); |
1104 | 1099 | ||
1105 | return dates.last(); | 1100 | return dates.last(); |
1106 | } | 1101 | } |
1107 | 1102 | ||
1108 | 1103 | ||
1109 | void CalendarView::createPrinter() | 1104 | void CalendarView::createPrinter() |
1110 | { | 1105 | { |
1111 | #ifndef KORG_NOPRINTER | 1106 | #ifndef KORG_NOPRINTER |
1112 | if (!mCalPrinter) { | 1107 | if (!mCalPrinter) { |
1113 | mCalPrinter = new CalPrinter(this, mCalendar); | 1108 | mCalPrinter = new CalPrinter(this, mCalendar); |
1114 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 1109 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
1115 | } | 1110 | } |
1116 | #endif | 1111 | #endif |
1117 | } | 1112 | } |
1118 | 1113 | ||
1119 | 1114 | ||
1120 | //KOPrefs::instance()->mWriteBackFile | 1115 | //KOPrefs::instance()->mWriteBackFile |
1121 | //KOPrefs::instance()->mWriteBackExistingOnly | 1116 | //KOPrefs::instance()->mWriteBackExistingOnly |
1122 | 1117 | ||
1123 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 1118 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
1124 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 1119 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
1125 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 1120 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
1126 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 1121 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
1127 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 1122 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
1128 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 1123 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
1129 | 1124 | ||
1130 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 1125 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
1131 | { | 1126 | { |
1132 | 1127 | ||
1133 | // 0 equal | 1128 | // 0 equal |
1134 | // 1 take local | 1129 | // 1 take local |
1135 | // 2 take remote | 1130 | // 2 take remote |
1136 | // 3 cancel | 1131 | // 3 cancel |
1137 | QDateTime lastSync = mLastCalendarSync; | 1132 | QDateTime lastSync = mLastCalendarSync; |
1138 | QDateTime localMod = local->lastModified(); | 1133 | QDateTime localMod = local->lastModified(); |
1139 | QDateTime remoteMod = remote->lastModified(); | 1134 | QDateTime remoteMod = remote->lastModified(); |
1140 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1135 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1141 | bool remCh, locCh; | 1136 | bool remCh, locCh; |
1142 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 1137 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
1143 | //if ( remCh ) | 1138 | //if ( remCh ) |
1144 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 1139 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
1145 | locCh = ( localMod > mLastCalendarSync ); | 1140 | locCh = ( localMod > mLastCalendarSync ); |
1146 | if ( !remCh && ! locCh ) { | 1141 | if ( !remCh && ! locCh ) { |
1147 | //qDebug("both not changed "); | 1142 | //qDebug("both not changed "); |
1148 | lastSync = localMod.addDays(1); | 1143 | lastSync = localMod.addDays(1); |
1149 | if ( mode <= SYNC_PREF_ASK ) | 1144 | if ( mode <= SYNC_PREF_ASK ) |
1150 | return 0; | 1145 | return 0; |
1151 | } else { | 1146 | } else { |
1152 | if ( locCh ) { | 1147 | if ( locCh ) { |
1153 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 1148 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
1154 | lastSync = localMod.addDays( -1 ); | 1149 | lastSync = localMod.addDays( -1 ); |
1155 | if ( !remCh ) | 1150 | if ( !remCh ) |
1156 | remoteMod = ( lastSync.addDays( -1 ) ); | 1151 | remoteMod = ( lastSync.addDays( -1 ) ); |
1157 | } else { | 1152 | } else { |
1158 | //qDebug(" not loc changed "); | 1153 | //qDebug(" not loc changed "); |
1159 | lastSync = localMod.addDays( 1 ); | 1154 | lastSync = localMod.addDays( 1 ); |
1160 | if ( remCh ) | 1155 | if ( remCh ) |
1161 | remoteMod =( lastSync.addDays( 1 ) ); | 1156 | remoteMod =( lastSync.addDays( 1 ) ); |
1162 | 1157 | ||
1163 | } | 1158 | } |
1164 | } | 1159 | } |
1165 | full = true; | 1160 | full = true; |
1166 | if ( mode < SYNC_PREF_ASK ) | 1161 | if ( mode < SYNC_PREF_ASK ) |
1167 | mode = SYNC_PREF_ASK; | 1162 | mode = SYNC_PREF_ASK; |
1168 | } else { | 1163 | } else { |
1169 | if ( localMod == remoteMod ) | 1164 | if ( localMod == remoteMod ) |
1170 | // if ( local->revision() == remote->revision() ) | 1165 | // if ( local->revision() == remote->revision() ) |
1171 | return 0; | 1166 | return 0; |
1172 | 1167 | ||
1173 | } | 1168 | } |
1174 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 1169 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
1175 | 1170 | ||
1176 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 1171 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
1177 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 1172 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
1178 | //full = true; //debug only | 1173 | //full = true; //debug only |
1179 | if ( full ) { | 1174 | if ( full ) { |
1180 | bool equ = false; | 1175 | bool equ = false; |
1181 | if ( local->typeID() == eventID ) { | 1176 | if ( local->typeID() == eventID ) { |
1182 | equ = (*((Event*) local) == *((Event*) remote)); | 1177 | equ = (*((Event*) local) == *((Event*) remote)); |
1183 | } | 1178 | } |
1184 | else if ( local->typeID() == todoID ) | 1179 | else if ( local->typeID() == todoID ) |
1185 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 1180 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
1186 | else if ( local->typeID() == journalID ) | 1181 | else if ( local->typeID() == journalID ) |
1187 | equ = (*((Journal*) local) == *((Journal*) remote)); | 1182 | equ = (*((Journal*) local) == *((Journal*) remote)); |
1188 | if ( equ ) { | 1183 | if ( equ ) { |
1189 | //qDebug("equal "); | 1184 | //qDebug("equal "); |
1190 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1185 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1191 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 1186 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
1192 | } | 1187 | } |
1193 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 1188 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
1194 | return 0; | 1189 | return 0; |
1195 | 1190 | ||
1196 | }//else //debug only | 1191 | }//else //debug only |
1197 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 1192 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
1198 | } | 1193 | } |
1199 | int result; | 1194 | int result; |
1200 | bool localIsNew; | 1195 | bool localIsNew; |
1201 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 1196 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
1202 | 1197 | ||
1203 | 1198 | ||
1204 | // ************************************************ | 1199 | // ************************************************ |
1205 | // ************************************************ | 1200 | // ************************************************ |
1206 | // ************************************************ | 1201 | // ************************************************ |
1207 | // We may have that lastSync > remoteMod AND lastSync > localMod | 1202 | // We may have that lastSync > remoteMod AND lastSync > localMod |
1208 | // BUT remoteMod != localMod | 1203 | // BUT remoteMod != localMod |
1209 | 1204 | ||
1210 | 1205 | ||
1211 | if ( full && mode < SYNC_PREF_NEWEST ) | 1206 | if ( full && mode < SYNC_PREF_NEWEST ) |
1212 | mode = SYNC_PREF_ASK; | 1207 | mode = SYNC_PREF_ASK; |
1213 | 1208 | ||
1214 | switch( mode ) { | 1209 | switch( mode ) { |
1215 | case SYNC_PREF_LOCAL: | 1210 | case SYNC_PREF_LOCAL: |
1216 | if ( lastSync > remoteMod ) | 1211 | if ( lastSync > remoteMod ) |
1217 | return 1; | 1212 | return 1; |
1218 | if ( lastSync > localMod ) | 1213 | if ( lastSync > localMod ) |
1219 | return 2; | 1214 | return 2; |
1220 | return 1; | 1215 | return 1; |
1221 | break; | 1216 | break; |
1222 | case SYNC_PREF_REMOTE: | 1217 | case SYNC_PREF_REMOTE: |
1223 | if ( lastSync > localMod ) | 1218 | if ( lastSync > localMod ) |
1224 | return 2; | 1219 | return 2; |
1225 | if ( lastSync > remoteMod ) | 1220 | if ( lastSync > remoteMod ) |
1226 | return 1; | 1221 | return 1; |
1227 | return 2; | 1222 | return 2; |
1228 | break; | 1223 | break; |
1229 | case SYNC_PREF_NEWEST: | 1224 | case SYNC_PREF_NEWEST: |
1230 | if ( localMod >= remoteMod ) | 1225 | if ( localMod >= remoteMod ) |
1231 | return 1; | 1226 | return 1; |
1232 | else | 1227 | else |
1233 | return 2; | 1228 | return 2; |
1234 | break; | 1229 | break; |
1235 | case SYNC_PREF_ASK: | 1230 | case SYNC_PREF_ASK: |
1236 | qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1231 | qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1237 | if ( lastSync > remoteMod && lastSync > localMod) | 1232 | if ( lastSync > remoteMod && lastSync > localMod) |
1238 | return 0; | 1233 | return 0; |
1239 | if ( lastSync > remoteMod ) | 1234 | if ( lastSync > remoteMod ) |
1240 | return 1; | 1235 | return 1; |
1241 | if ( lastSync > localMod ) | 1236 | if ( lastSync > localMod ) |
1242 | return 2; | 1237 | return 2; |
1243 | qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1238 | qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1244 | localIsNew = localMod >= remoteMod; | 1239 | localIsNew = localMod >= remoteMod; |
1245 | if ( localIsNew ) | 1240 | if ( localIsNew ) |
1246 | getEventViewerDialog()->setColorMode( 1 ); | 1241 | getEventViewerDialog()->setColorMode( 1 ); |
1247 | else | 1242 | else |
1248 | getEventViewerDialog()->setColorMode( 2 ); | 1243 | getEventViewerDialog()->setColorMode( 2 ); |
1249 | getEventViewerDialog()->setIncidence(local); | 1244 | getEventViewerDialog()->setIncidence(local); |
1250 | if ( localIsNew ) | 1245 | if ( localIsNew ) |
1251 | getEventViewerDialog()->setColorMode( 2 ); | 1246 | getEventViewerDialog()->setColorMode( 2 ); |
1252 | else | 1247 | else |
1253 | getEventViewerDialog()->setColorMode( 1 ); | 1248 | getEventViewerDialog()->setColorMode( 1 ); |
1254 | getEventViewerDialog()->addIncidence(remote); | 1249 | getEventViewerDialog()->addIncidence(remote); |
1255 | getEventViewerDialog()->setColorMode( 0 ); | 1250 | getEventViewerDialog()->setColorMode( 0 ); |
1256 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 1251 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
1257 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 1252 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
1258 | getEventViewerDialog()->showMe(); | 1253 | getEventViewerDialog()->showMe(); |
1259 | result = getEventViewerDialog()->executeS( localIsNew ); | 1254 | result = getEventViewerDialog()->executeS( localIsNew ); |
1260 | return result; | 1255 | return result; |
1261 | 1256 | ||
1262 | break; | 1257 | break; |
1263 | case SYNC_PREF_FORCE_LOCAL: | 1258 | case SYNC_PREF_FORCE_LOCAL: |
1264 | return 1; | 1259 | return 1; |
1265 | break; | 1260 | break; |
1266 | case SYNC_PREF_FORCE_REMOTE: | 1261 | case SYNC_PREF_FORCE_REMOTE: |
1267 | return 2; | 1262 | return 2; |
1268 | break; | 1263 | break; |
1269 | 1264 | ||
1270 | default: | 1265 | default: |
1271 | // SYNC_PREF_TAKE_BOTH not implemented | 1266 | // SYNC_PREF_TAKE_BOTH not implemented |
1272 | break; | 1267 | break; |
1273 | } | 1268 | } |
1274 | return 0; | 1269 | return 0; |
1275 | } | 1270 | } |
1276 | Event* CalendarView::getLastSyncEvent() | 1271 | Event* CalendarView::getLastSyncEvent() |
1277 | { | 1272 | { |
1278 | Event* lse; | 1273 | Event* lse; |
1279 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 1274 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
1280 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 1275 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
1281 | if (!lse) { | 1276 | if (!lse) { |
1282 | lse = new Event(); | 1277 | lse = new Event(); |
1283 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 1278 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
1284 | QString sum = ""; | 1279 | QString sum = ""; |
1285 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 1280 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
1286 | sum = "E: "; | 1281 | sum = "E: "; |
1287 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 1282 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
1288 | lse->setDtStart( mLastCalendarSync ); | 1283 | lse->setDtStart( mLastCalendarSync ); |
1289 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1284 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1290 | lse->setCategories( i18n("SyncEvent") ); | 1285 | lse->setCategories( i18n("SyncEvent") ); |
1291 | lse->setReadOnly( true ); | 1286 | lse->setReadOnly( true ); |
1292 | mCalendar->addEvent( lse ); | 1287 | mCalendar->addEvent( lse ); |
1293 | } | 1288 | } |
1294 | 1289 | ||
1295 | return lse; | 1290 | return lse; |
1296 | 1291 | ||
1297 | } | 1292 | } |
1298 | 1293 | ||
1299 | // we check, if the to delete event has a id for a profile | 1294 | // we check, if the to delete event has a id for a profile |
1300 | // if yes, we set this id in the profile to delete | 1295 | // if yes, we set this id in the profile to delete |
1301 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 1296 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
1302 | { | 1297 | { |
1303 | if ( lastSync.count() == 0 ) { | 1298 | if ( lastSync.count() == 0 ) { |
1304 | //qDebug(" lastSync.count() == 0"); | 1299 | //qDebug(" lastSync.count() == 0"); |
1305 | return; | 1300 | return; |
1306 | } | 1301 | } |
1307 | if ( toDelete->typeID() == journalID ) | 1302 | if ( toDelete->typeID() == journalID ) |
1308 | return; | 1303 | return; |
1309 | 1304 | ||
1310 | Event* eve = lastSync.first(); | 1305 | Event* eve = lastSync.first(); |
1311 | 1306 | ||
1312 | while ( eve ) { | 1307 | while ( eve ) { |
1313 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 1308 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
1314 | if ( !id.isEmpty() ) { | 1309 | if ( !id.isEmpty() ) { |
1315 | QString des = eve->description(); | 1310 | QString des = eve->description(); |
1316 | QString pref = "e"; | 1311 | QString pref = "e"; |
1317 | if ( toDelete->typeID() == todoID ) | 1312 | if ( toDelete->typeID() == todoID ) |
1318 | pref = "t"; | 1313 | pref = "t"; |
1319 | des += pref+ id + ","; | 1314 | des += pref+ id + ","; |
1320 | eve->setReadOnly( false ); | 1315 | eve->setReadOnly( false ); |
1321 | eve->setDescription( des ); | 1316 | eve->setDescription( des ); |
1322 | //qDebug("setdes %s ", des.latin1()); | 1317 | //qDebug("setdes %s ", des.latin1()); |
1323 | eve->setReadOnly( true ); | 1318 | eve->setReadOnly( true ); |
1324 | } | 1319 | } |
1325 | eve = lastSync.next(); | 1320 | eve = lastSync.next(); |
1326 | } | 1321 | } |
1327 | 1322 | ||
1328 | } | 1323 | } |
1329 | void CalendarView::checkExternalId( Incidence * inc ) | 1324 | void CalendarView::checkExternalId( Incidence * inc ) |
1330 | { | 1325 | { |
1331 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 1326 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
1332 | checkExternSyncEvent( lastSync, inc ); | 1327 | checkExternSyncEvent( lastSync, inc ); |
1333 | 1328 | ||
1334 | } | 1329 | } |
1335 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 1330 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
1336 | { | 1331 | { |
1337 | bool syncOK = true; | 1332 | bool syncOK = true; |
1338 | int addedEvent = 0; | 1333 | int addedEvent = 0; |
1339 | int addedEventR = 0; | 1334 | int addedEventR = 0; |
1340 | int deletedEventR = 0; | 1335 | int deletedEventR = 0; |
1341 | int deletedEventL = 0; | 1336 | int deletedEventL = 0; |
1342 | int changedLocal = 0; | 1337 | int changedLocal = 0; |
1343 | int changedRemote = 0; | 1338 | int changedRemote = 0; |
1344 | int filteredIN = 0; | 1339 | int filteredIN = 0; |
1345 | int filteredOUT = 0; | 1340 | int filteredOUT = 0; |
1346 | //QPtrList<Event> el = local->rawEvents(); | 1341 | //QPtrList<Event> el = local->rawEvents(); |
1347 | Event* eventR; | 1342 | Event* eventR; |
1348 | QString uid; | 1343 | QString uid; |
1349 | int take; | 1344 | int take; |
1350 | Event* eventRSync; | 1345 | Event* eventRSync; |
1351 | Event* eventLSync; | 1346 | Event* eventLSync; |
1352 | clearAllViews(); | 1347 | clearAllViews(); |
1353 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 1348 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
1354 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 1349 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
1355 | bool fullDateRange = false; | 1350 | bool fullDateRange = false; |
1356 | local->resetTempSyncStat(); | 1351 | local->resetTempSyncStat(); |
1357 | mLastCalendarSync = QDateTime::currentDateTime(); | 1352 | mLastCalendarSync = QDateTime::currentDateTime(); |
1358 | if ( mSyncManager->syncWithDesktop() ) { | 1353 | if ( mSyncManager->syncWithDesktop() ) { |
1359 | remote->resetPilotStat(1); | 1354 | remote->resetPilotStat(1); |
1360 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1355 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1361 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 1356 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
1362 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 1357 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
1363 | } else { | 1358 | } else { |
1364 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 1359 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
1365 | } | 1360 | } |
1366 | } | 1361 | } |
1367 | QDateTime modifiedCalendar = mLastCalendarSync; | 1362 | QDateTime modifiedCalendar = mLastCalendarSync; |
1368 | eventLSync = getLastSyncEvent(); | 1363 | eventLSync = getLastSyncEvent(); |
1369 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 1364 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
1370 | if ( eventR ) { | 1365 | if ( eventR ) { |
1371 | qDebug("last-syncEvent on remote found "); | 1366 | qDebug("last-syncEvent on remote found "); |
1372 | eventRSync = (Event*) eventR->clone(); | 1367 | eventRSync = (Event*) eventR->clone(); |
1373 | remote->deleteEvent(eventR ); | 1368 | remote->deleteEvent(eventR ); |
1374 | 1369 | ||
1375 | } else { | 1370 | } else { |
1376 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 1371 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
1377 | eventRSync = (Event*)eventLSync->clone(); | 1372 | eventRSync = (Event*)eventLSync->clone(); |
1378 | } else { | 1373 | } else { |
1379 | fullDateRange = true; | 1374 | fullDateRange = true; |
1380 | eventRSync = new Event(); | 1375 | eventRSync = new Event(); |
1381 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 1376 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
1382 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 1377 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
1383 | eventRSync->setDtStart( mLastCalendarSync ); | 1378 | eventRSync->setDtStart( mLastCalendarSync ); |
1384 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1379 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1385 | eventRSync->setCategories( i18n("SyncEvent") ); | 1380 | eventRSync->setCategories( i18n("SyncEvent") ); |
1386 | } | 1381 | } |
1387 | } | 1382 | } |
1388 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 1383 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
1389 | fullDateRange = true; | 1384 | fullDateRange = true; |
1390 | 1385 | ||
1391 | if ( ! fullDateRange ) { | 1386 | if ( ! fullDateRange ) { |
1392 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 1387 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
1393 | 1388 | ||
1394 | qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 1389 | qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
1395 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 1390 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
1396 | fullDateRange = true; | 1391 | fullDateRange = true; |
1397 | } | 1392 | } |
1398 | } | 1393 | } |
1399 | if ( mSyncManager->syncWithDesktop() ) { | 1394 | if ( mSyncManager->syncWithDesktop() ) { |
1400 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 1395 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
1401 | } | 1396 | } |
1402 | if ( fullDateRange ) | 1397 | if ( fullDateRange ) |
1403 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 1398 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
1404 | else | 1399 | else |
1405 | mLastCalendarSync = eventLSync->dtStart(); | 1400 | mLastCalendarSync = eventLSync->dtStart(); |
1406 | // for resyncing if own file has changed | 1401 | // for resyncing if own file has changed |
1407 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 1402 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
1408 | mLastCalendarSync = loadedFileVersion; | 1403 | mLastCalendarSync = loadedFileVersion; |
1409 | //qDebug("setting mLastCalendarSync "); | 1404 | //qDebug("setting mLastCalendarSync "); |
1410 | } | 1405 | } |
1411 | //qDebug("*************************** "); | 1406 | //qDebug("*************************** "); |
1412 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 1407 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
1413 | QPtrList<Incidence> er = remote->rawIncidences(); | 1408 | QPtrList<Incidence> er = remote->rawIncidences(); |
1414 | Incidence* inR = er.first(); | 1409 | Incidence* inR = er.first(); |
1415 | Incidence* inL; | 1410 | Incidence* inL; |
1416 | QProgressBar bar( er.count(),0 ); | 1411 | QProgressBar bar( er.count(),0 ); |
1417 | bar.setCaption (i18n("Syncing - close to abort!") ); | 1412 | bar.setCaption (i18n("Syncing - close to abort!") ); |
1418 | 1413 | ||
1419 | // ************** setting up filter ************* | 1414 | // ************** setting up filter ************* |
1420 | CalFilter *filterIN = 0; | 1415 | CalFilter *filterIN = 0; |
1421 | CalFilter *filterOUT = 0; | 1416 | CalFilter *filterOUT = 0; |
1422 | CalFilter *filter = mFilters.first(); | 1417 | CalFilter *filter = mFilters.first(); |
1423 | while(filter) { | 1418 | while(filter) { |
1424 | if ( filter->name() == mSyncManager->mFilterInCal ) | 1419 | if ( filter->name() == mSyncManager->mFilterInCal ) |
1425 | filterIN = filter; | 1420 | filterIN = filter; |
1426 | if ( filter->name() == mSyncManager->mFilterOutCal ) | 1421 | if ( filter->name() == mSyncManager->mFilterOutCal ) |
1427 | filterOUT = filter; | 1422 | filterOUT = filter; |
1428 | filter = mFilters.next(); | 1423 | filter = mFilters.next(); |
1429 | } | 1424 | } |
1430 | int w = 300; | 1425 | int w = 300; |
1431 | if ( QApplication::desktop()->width() < 320 ) | 1426 | if ( QApplication::desktop()->width() < 320 ) |
1432 | w = 220; | 1427 | w = 220; |
1433 | int h = bar.sizeHint().height() ; | 1428 | int h = bar.sizeHint().height() ; |
1434 | int dw = QApplication::desktop()->width(); | 1429 | int dw = QApplication::desktop()->width(); |
1435 | int dh = QApplication::desktop()->height(); | 1430 | int dh = QApplication::desktop()->height(); |
1436 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1431 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1437 | bar.show(); | 1432 | bar.show(); |
1438 | int modulo = (er.count()/10)+1; | 1433 | int modulo = (er.count()/10)+1; |
1439 | int incCounter = 0; | 1434 | int incCounter = 0; |
1440 | while ( inR ) { | 1435 | while ( inR ) { |
1441 | if ( ! bar.isVisible() ) | 1436 | if ( ! bar.isVisible() ) |
1442 | return false; | 1437 | return false; |
1443 | if ( incCounter % modulo == 0 ) | 1438 | if ( incCounter % modulo == 0 ) |
1444 | bar.setProgress( incCounter ); | 1439 | bar.setProgress( incCounter ); |
1445 | ++incCounter; | 1440 | ++incCounter; |
1446 | uid = inR->uid(); | 1441 | uid = inR->uid(); |
1447 | bool skipIncidence = false; | 1442 | bool skipIncidence = false; |
1448 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1443 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1449 | skipIncidence = true; | 1444 | skipIncidence = true; |
1450 | QString idS; | 1445 | QString idS; |
1451 | qApp->processEvents(); | 1446 | qApp->processEvents(); |
1452 | if ( !skipIncidence ) { | 1447 | if ( !skipIncidence ) { |
1453 | inL = local->incidenceForUid( uid , false ); | 1448 | inL = local->incidenceForUid( uid , false ); |
1454 | if ( inL ) { // maybe conflict - same uid in both calendars | 1449 | if ( inL ) { // maybe conflict - same uid in both calendars |
1455 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1450 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1456 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1451 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1457 | if ( take == 3 ) | 1452 | if ( take == 3 ) |
1458 | return false; | 1453 | return false; |
1459 | if ( take == 1 ) {// take local ********************** | 1454 | if ( take == 1 ) {// take local ********************** |
1460 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1455 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1461 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1456 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1462 | else | 1457 | else |
1463 | idS = inR->IDStr(); | 1458 | idS = inR->IDStr(); |
1464 | int calID = inR->calID(); | 1459 | int calID = inR->calID(); |
1465 | remote->deleteIncidence( inR ); | 1460 | remote->deleteIncidence( inR ); |
1466 | inR = inL->clone(); | 1461 | inR = inL->clone(); |
1467 | inR->setCalID( calID ); | 1462 | inR->setCalID( calID ); |
1468 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1463 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1469 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1464 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1470 | inR->setIDStr( idS ); | 1465 | inR->setIDStr( idS ); |
1471 | remote->addIncidence( inR ); | 1466 | remote->addIncidence( inR ); |
1472 | if ( mSyncManager->syncWithDesktop() ) | 1467 | if ( mSyncManager->syncWithDesktop() ) |
1473 | inR->setPilotId( 2 ); | 1468 | inR->setPilotId( 2 ); |
1474 | ++changedRemote; | 1469 | ++changedRemote; |
1475 | } else {// take remote ********************** | 1470 | } else {// take remote ********************** |
1476 | if ( !inL->isReadOnly() ) { | 1471 | if ( !inL->isReadOnly() ) { |
1477 | idS = inL->IDStr(); | 1472 | idS = inL->IDStr(); |
1478 | int pid = inL->pilotId(); | 1473 | int pid = inL->pilotId(); |
1479 | int calID = inL->calID(); | 1474 | int calID = inL->calID(); |
1480 | local->deleteIncidence( inL ); | 1475 | local->deleteIncidence( inL ); |
1481 | inL = inR->clone(); | 1476 | inL = inR->clone(); |
1482 | inL->setCalID( calID ); | 1477 | inL->setCalID( calID ); |
1483 | if ( mSyncManager->syncWithDesktop() ) | 1478 | if ( mSyncManager->syncWithDesktop() ) |
1484 | inL->setPilotId( pid ); | 1479 | inL->setPilotId( pid ); |
1485 | inL->setIDStr( idS ); | 1480 | inL->setIDStr( idS ); |
1486 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1481 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1487 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1482 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1488 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1483 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1489 | } | 1484 | } |
1490 | local->addIncidence( inL ); | 1485 | local->addIncidence( inL ); |
1491 | ++changedLocal; | 1486 | ++changedLocal; |
1492 | } | 1487 | } |
1493 | } | 1488 | } |
1494 | } | 1489 | } |
1495 | } else { // no conflict ********** add or delete remote | 1490 | } else { // no conflict ********** add or delete remote |
1496 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1491 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1497 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1492 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1498 | QString des = eventLSync->description(); | 1493 | QString des = eventLSync->description(); |
1499 | QString pref = "e"; | 1494 | QString pref = "e"; |
1500 | if ( inR->typeID() == todoID ) | 1495 | if ( inR->typeID() == todoID ) |
1501 | pref = "t"; | 1496 | pref = "t"; |
1502 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1497 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1503 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1498 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1504 | //remote->deleteIncidence( inR ); | 1499 | //remote->deleteIncidence( inR ); |
1505 | ++deletedEventR; | 1500 | ++deletedEventR; |
1506 | } else { | 1501 | } else { |
1507 | inR->setLastModified( modifiedCalendar ); | 1502 | inR->setLastModified( modifiedCalendar ); |
1508 | inL = inR->clone(); | 1503 | inL = inR->clone(); |
1509 | inL->setIDStr( ":" ); | 1504 | inL->setIDStr( ":" ); |
1510 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1505 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1511 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1506 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1512 | 1507 | ||
1513 | inL->setCalID( 0 );// add to default cal | 1508 | inL->setCalID( 0 );// add to default cal |
1514 | local->addIncidence( inL ); | 1509 | local->addIncidence( inL ); |
1515 | ++addedEvent; | 1510 | ++addedEvent; |
1516 | 1511 | ||
1517 | } | 1512 | } |
1518 | } else { | 1513 | } else { |
1519 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1514 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1520 | inR->setLastModified( modifiedCalendar ); | 1515 | inR->setLastModified( modifiedCalendar ); |
1521 | inL = inR->clone(); | 1516 | inL = inR->clone(); |
1522 | inL->setIDStr( ":" ); | 1517 | inL->setIDStr( ":" ); |
1523 | inL->setCalID( 0 );// add to default cal | 1518 | inL->setCalID( 0 );// add to default cal |
1524 | local->addIncidence( inL ); | 1519 | local->addIncidence( inL ); |
1525 | ++addedEvent; | 1520 | ++addedEvent; |
1526 | 1521 | ||
1527 | } else { | 1522 | } else { |
1528 | checkExternSyncEvent(eventRSyncSharp, inR); | 1523 | checkExternSyncEvent(eventRSyncSharp, inR); |
1529 | remote->deleteIncidence( inR ); | 1524 | remote->deleteIncidence( inR ); |
1530 | ++deletedEventR; | 1525 | ++deletedEventR; |
1531 | } | 1526 | } |
1532 | } | 1527 | } |
1533 | } else { | 1528 | } else { |
1534 | ++filteredIN; | 1529 | ++filteredIN; |
1535 | } | 1530 | } |
1536 | } | 1531 | } |
1537 | } | 1532 | } |
1538 | inR = er.next(); | 1533 | inR = er.next(); |
1539 | } | 1534 | } |
1540 | QPtrList<Incidence> el = local->rawIncidences(); | 1535 | QPtrList<Incidence> el = local->rawIncidences(); |
1541 | inL = el.first(); | 1536 | inL = el.first(); |
1542 | modulo = (el.count()/10)+1; | 1537 | modulo = (el.count()/10)+1; |
1543 | bar.setCaption (i18n("Add / remove events") ); | 1538 | bar.setCaption (i18n("Add / remove events") ); |
1544 | bar.setTotalSteps ( el.count() ) ; | 1539 | bar.setTotalSteps ( el.count() ) ; |
1545 | bar.show(); | 1540 | bar.show(); |
1546 | incCounter = 0; | 1541 | incCounter = 0; |
1547 | 1542 | ||
1548 | while ( inL ) { | 1543 | while ( inL ) { |
1549 | 1544 | ||
1550 | qApp->processEvents(); | 1545 | qApp->processEvents(); |
1551 | if ( ! bar.isVisible() ) | 1546 | if ( ! bar.isVisible() ) |
1552 | return false; | 1547 | return false; |
1553 | if ( incCounter % modulo == 0 ) | 1548 | if ( incCounter % modulo == 0 ) |
1554 | bar.setProgress( incCounter ); | 1549 | bar.setProgress( incCounter ); |
1555 | ++incCounter; | 1550 | ++incCounter; |
1556 | uid = inL->uid(); | 1551 | uid = inL->uid(); |
1557 | bool skipIncidence = false; | 1552 | bool skipIncidence = false; |
1558 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1553 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1559 | skipIncidence = true; | 1554 | skipIncidence = true; |
1560 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) | 1555 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) |
1561 | skipIncidence = true; | 1556 | skipIncidence = true; |
1562 | if ( !skipIncidence ) { | 1557 | if ( !skipIncidence ) { |
1563 | inR = remote->incidenceForUid( uid , true ); | 1558 | inR = remote->incidenceForUid( uid , true ); |
1564 | if ( ! inR ) { | 1559 | if ( ! inR ) { |
1565 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1560 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1566 | // no conflict ********** add or delete local | 1561 | // no conflict ********** add or delete local |
1567 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1562 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1568 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1563 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1569 | checkExternSyncEvent(eventLSyncSharp, inL); | 1564 | checkExternSyncEvent(eventLSyncSharp, inL); |
1570 | local->deleteIncidence( inL ); | 1565 | local->deleteIncidence( inL ); |
1571 | ++deletedEventL; | 1566 | ++deletedEventL; |
1572 | } else { | 1567 | } else { |
1573 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1568 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1574 | inL->removeID(mCurrentSyncDevice ); | 1569 | inL->removeID(mCurrentSyncDevice ); |
1575 | ++addedEventR; | 1570 | ++addedEventR; |
1576 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1571 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1577 | inL->setLastModified( modifiedCalendar ); | 1572 | inL->setLastModified( modifiedCalendar ); |
1578 | inR = inL->clone(); | 1573 | inR = inL->clone(); |
1579 | inR->setIDStr( ":" ); | 1574 | inR->setIDStr( ":" ); |
1580 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1575 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1581 | inR->setCalID( 0 );// add to default cal | 1576 | inR->setCalID( 0 );// add to default cal |
1582 | remote->addIncidence( inR ); | 1577 | remote->addIncidence( inR ); |
1583 | } | 1578 | } |
1584 | } | 1579 | } |
1585 | } else { | 1580 | } else { |
1586 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1581 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1587 | checkExternSyncEvent(eventLSyncSharp, inL); | 1582 | checkExternSyncEvent(eventLSyncSharp, inL); |
1588 | local->deleteIncidence( inL ); | 1583 | local->deleteIncidence( inL ); |
1589 | ++deletedEventL; | 1584 | ++deletedEventL; |
1590 | } else { | 1585 | } else { |
1591 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1586 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1592 | ++addedEventR; | 1587 | ++addedEventR; |
1593 | inL->setLastModified( modifiedCalendar ); | 1588 | inL->setLastModified( modifiedCalendar ); |
1594 | inR = inL->clone(); | 1589 | inR = inL->clone(); |
1595 | inR->setIDStr( ":" ); | 1590 | inR->setIDStr( ":" ); |
1596 | inR->setCalID( 0 );// add to default cal | 1591 | inR->setCalID( 0 );// add to default cal |
1597 | remote->addIncidence( inR ); | 1592 | remote->addIncidence( inR ); |
1598 | } | 1593 | } |
1599 | } | 1594 | } |
1600 | } | 1595 | } |
1601 | } else { | 1596 | } else { |
1602 | ++filteredOUT; | 1597 | ++filteredOUT; |
1603 | } | 1598 | } |
1604 | } | 1599 | } |
1605 | } | 1600 | } |
1606 | inL = el.next(); | 1601 | inL = el.next(); |
1607 | } | 1602 | } |
1608 | int delFut = 0; | 1603 | int delFut = 0; |
1609 | int remRem = 0; | 1604 | int remRem = 0; |
1610 | if ( mSyncManager->mWriteBackInFuture ) { | 1605 | if ( mSyncManager->mWriteBackInFuture ) { |
1611 | er = remote->rawIncidences(); | 1606 | er = remote->rawIncidences(); |
1612 | remRem = er.count(); | 1607 | remRem = er.count(); |
1613 | inR = er.first(); | 1608 | inR = er.first(); |
1614 | QDateTime dt; | 1609 | QDateTime dt; |
1615 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); | 1610 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); |
1616 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); | 1611 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); |
1617 | while ( inR ) { | 1612 | while ( inR ) { |
1618 | if ( inR->typeID() == todoID ) { | 1613 | if ( inR->typeID() == todoID ) { |
1619 | Todo * t = (Todo*)inR; | 1614 | Todo * t = (Todo*)inR; |
1620 | if ( t->hasDueDate() ) | 1615 | if ( t->hasDueDate() ) |
1621 | dt = t->dtDue(); | 1616 | dt = t->dtDue(); |
1622 | else | 1617 | else |
1623 | dt = cur.addSecs( 62 ); | 1618 | dt = cur.addSecs( 62 ); |
1624 | } | 1619 | } |
1625 | else if (inR->typeID() == eventID ) { | 1620 | else if (inR->typeID() == eventID ) { |
1626 | bool ok; | 1621 | bool ok; |
1627 | dt = inR->getNextOccurence( cur, &ok ); | 1622 | dt = inR->getNextOccurence( cur, &ok ); |
1628 | if ( !ok ) | 1623 | if ( !ok ) |
1629 | dt = cur.addSecs( -62 ); | 1624 | dt = cur.addSecs( -62 ); |
1630 | } | 1625 | } |
1631 | else | 1626 | else |
1632 | dt = inR->dtStart(); | 1627 | dt = inR->dtStart(); |
1633 | if ( dt < cur || dt > end ) { | 1628 | if ( dt < cur || dt > end ) { |
1634 | remote->deleteIncidence( inR ); | 1629 | remote->deleteIncidence( inR ); |
1635 | ++delFut; | 1630 | ++delFut; |
1636 | } | 1631 | } |
1637 | inR = er.next(); | 1632 | inR = er.next(); |
1638 | } | 1633 | } |
1639 | } | 1634 | } |
1640 | bar.hide(); | 1635 | bar.hide(); |
1641 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1636 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1642 | eventLSync->setReadOnly( false ); | 1637 | eventLSync->setReadOnly( false ); |
1643 | eventLSync->setDtStart( mLastCalendarSync ); | 1638 | eventLSync->setDtStart( mLastCalendarSync ); |
1644 | eventRSync->setDtStart( mLastCalendarSync ); | 1639 | eventRSync->setDtStart( mLastCalendarSync ); |
1645 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1640 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1646 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1641 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1647 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1642 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1648 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1643 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1649 | eventLSync->setReadOnly( true ); | 1644 | eventLSync->setReadOnly( true ); |
1650 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); | 1645 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); |
1651 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1646 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1652 | remote->addEvent( eventRSync ); | 1647 | remote->addEvent( eventRSync ); |
1653 | else | 1648 | else |
1654 | delete eventRSync; | 1649 | delete eventRSync; |
1655 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); | 1650 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); |
1656 | QString mes; | 1651 | QString mes; |
1657 | 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 ); | 1652 | 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 ); |
1658 | QString delmess; | 1653 | QString delmess; |
1659 | if ( delFut ) { | 1654 | if ( delFut ) { |
1660 | 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); | 1655 | 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); |
1661 | mes += delmess; | 1656 | mes += delmess; |
1662 | } | 1657 | } |
1663 | mes = i18n("Local calendar changed!\n") +mes; | 1658 | mes = i18n("Local calendar changed!\n") +mes; |
1664 | mCalendar->checkAlarmForIncidence( 0, true ); | 1659 | mCalendar->checkAlarmForIncidence( 0, true ); |
1665 | qDebug( mes ); | 1660 | qDebug( mes ); |
1666 | if ( mSyncManager->mShowSyncSummary ) { | 1661 | if ( mSyncManager->mShowSyncSummary ) { |
1667 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 1662 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1668 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | 1663 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { |
1669 | qDebug("KO: WB cancelled "); | 1664 | qDebug("KO: WB cancelled "); |
1670 | mSyncManager->mWriteBackFile = false; | 1665 | mSyncManager->mWriteBackFile = false; |
1671 | return syncOK; | 1666 | return syncOK; |
1672 | } | 1667 | } |
1673 | } | 1668 | } |
1674 | return syncOK; | 1669 | return syncOK; |
1675 | } | 1670 | } |
1676 | 1671 | ||
1677 | void CalendarView::setSyncDevice( QString s ) | 1672 | void CalendarView::setSyncDevice( QString s ) |
1678 | { | 1673 | { |
1679 | mCurrentSyncDevice= s; | 1674 | mCurrentSyncDevice= s; |
1680 | } | 1675 | } |
1681 | void CalendarView::setSyncName( QString s ) | 1676 | void CalendarView::setSyncName( QString s ) |
1682 | { | 1677 | { |
1683 | mCurrentSyncName= s; | 1678 | mCurrentSyncName= s; |
1684 | } | 1679 | } |
1685 | bool CalendarView::syncCalendar(QString filename, int mode) | 1680 | bool CalendarView::syncCalendar(QString filename, int mode) |
1686 | { | 1681 | { |
1687 | //qDebug("syncCalendar %s ", filename.latin1()); | 1682 | //qDebug("syncCalendar %s ", filename.latin1()); |
1688 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1683 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1689 | CalendarLocal* calendar = new CalendarLocal(); | 1684 | CalendarLocal* calendar = new CalendarLocal(); |
1690 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1685 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1691 | FileStorage* storage = new FileStorage( calendar ); | 1686 | FileStorage* storage = new FileStorage( calendar ); |
1692 | bool syncOK = false; | 1687 | bool syncOK = false; |
1693 | storage->setFileName( filename ); | 1688 | storage->setFileName( filename ); |
1694 | // qDebug("loading ... "); | 1689 | // qDebug("loading ... "); |
1695 | if ( storage->load() ) { | 1690 | if ( storage->load() ) { |
1696 | getEventViewerDialog()->setSyncMode( true ); | 1691 | getEventViewerDialog()->setSyncMode( true ); |
1697 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1692 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1698 | getEventViewerDialog()->setSyncMode( false ); | 1693 | getEventViewerDialog()->setSyncMode( false ); |
1699 | if ( syncOK ) { | 1694 | if ( syncOK ) { |
1700 | if ( mSyncManager->mWriteBackFile ) | 1695 | if ( mSyncManager->mWriteBackFile ) |
1701 | { | 1696 | { |
1702 | storage->setSaveFormat( new ICalFormat() ); | 1697 | storage->setSaveFormat( new ICalFormat() ); |
1703 | storage->save(); | 1698 | storage->save(); |
1704 | } | 1699 | } |
1705 | } | 1700 | } |
1706 | setModified( true ); | 1701 | setModified( true ); |
1707 | } | 1702 | } |
1708 | delete storage; | 1703 | delete storage; |
1709 | delete calendar; | 1704 | delete calendar; |
1710 | if ( syncOK ) | 1705 | if ( syncOK ) |
1711 | updateView(); | 1706 | updateView(); |
1712 | return syncOK; | 1707 | return syncOK; |
1713 | } | 1708 | } |
1714 | 1709 | ||
1715 | void CalendarView::syncExternal( int mode ) | 1710 | void CalendarView::syncExternal( int mode ) |
1716 | { | 1711 | { |
1717 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1712 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1718 | 1713 | ||
1719 | qApp->processEvents(); | 1714 | qApp->processEvents(); |
1720 | CalendarLocal* calendar = new CalendarLocal(); | 1715 | CalendarLocal* calendar = new CalendarLocal(); |
1721 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1716 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1722 | bool syncOK = false; | 1717 | bool syncOK = false; |
1723 | bool loadSuccess = false; | 1718 | bool loadSuccess = false; |
1724 | PhoneFormat* phoneFormat = 0; | 1719 | PhoneFormat* phoneFormat = 0; |
1725 | emit tempDisableBR(true); | 1720 | emit tempDisableBR(true); |
1726 | #ifndef DESKTOP_VERSION | 1721 | #ifndef DESKTOP_VERSION |
1727 | SharpFormat* sharpFormat = 0; | 1722 | SharpFormat* sharpFormat = 0; |
1728 | if ( mode == 0 ) { // sharp | 1723 | if ( mode == 0 ) { // sharp |
1729 | sharpFormat = new SharpFormat () ; | 1724 | sharpFormat = new SharpFormat () ; |
1730 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1725 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1731 | 1726 | ||
1732 | } else | 1727 | } else |
1733 | #endif | 1728 | #endif |
1734 | if ( mode == 1 ) { // phone | 1729 | if ( mode == 1 ) { // phone |
1735 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1730 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1736 | mSyncManager->mPhoneDevice, | 1731 | mSyncManager->mPhoneDevice, |
1737 | mSyncManager->mPhoneConnection, | 1732 | mSyncManager->mPhoneConnection, |
1738 | mSyncManager->mPhoneModel); | 1733 | mSyncManager->mPhoneModel); |
1739 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1734 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1740 | 1735 | ||
1741 | } else { | 1736 | } else { |
1742 | emit tempDisableBR(false); | 1737 | emit tempDisableBR(false); |
1743 | return; | 1738 | return; |
1744 | } | 1739 | } |
1745 | if ( loadSuccess ) { | 1740 | if ( loadSuccess ) { |
1746 | getEventViewerDialog()->setSyncMode( true ); | 1741 | getEventViewerDialog()->setSyncMode( true ); |
1747 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1742 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1748 | getEventViewerDialog()->setSyncMode( false ); | 1743 | getEventViewerDialog()->setSyncMode( false ); |
1749 | qApp->processEvents(); | 1744 | qApp->processEvents(); |
1750 | if ( syncOK ) { | 1745 | if ( syncOK ) { |
1751 | if ( mSyncManager->mWriteBackFile ) | 1746 | if ( mSyncManager->mWriteBackFile ) |
1752 | { | 1747 | { |
1753 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1748 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1754 | Incidence* inc = iL.first(); | 1749 | Incidence* inc = iL.first(); |
1755 | if ( phoneFormat ) { | 1750 | if ( phoneFormat ) { |
1756 | while ( inc ) { | 1751 | while ( inc ) { |
1757 | inc->removeID(mCurrentSyncDevice); | 1752 | inc->removeID(mCurrentSyncDevice); |
1758 | inc = iL.next(); | 1753 | inc = iL.next(); |
1759 | } | 1754 | } |
1760 | } | 1755 | } |
1761 | #ifndef DESKTOP_VERSION | 1756 | #ifndef DESKTOP_VERSION |
1762 | if ( sharpFormat ) | 1757 | if ( sharpFormat ) |
1763 | sharpFormat->save(calendar); | 1758 | sharpFormat->save(calendar); |
1764 | #endif | 1759 | #endif |
1765 | if ( phoneFormat ) | 1760 | if ( phoneFormat ) |
1766 | phoneFormat->save(calendar); | 1761 | phoneFormat->save(calendar); |
1767 | iL = calendar->rawIncidences(); | 1762 | iL = calendar->rawIncidences(); |
1768 | inc = iL.first(); | 1763 | inc = iL.first(); |
1769 | Incidence* loc; | 1764 | Incidence* loc; |
1770 | while ( inc ) { | 1765 | while ( inc ) { |
1771 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1766 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1772 | loc = mCalendar->incidence(inc->uid() ); | 1767 | loc = mCalendar->incidence(inc->uid() ); |
1773 | if ( loc ) { | 1768 | if ( loc ) { |
1774 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1769 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1775 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1770 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1776 | } | 1771 | } |
1777 | } | 1772 | } |
1778 | inc = iL.next(); | 1773 | inc = iL.next(); |
1779 | } | 1774 | } |
1780 | Incidence* lse = getLastSyncEvent(); | 1775 | Incidence* lse = getLastSyncEvent(); |
1781 | if ( lse ) { | 1776 | if ( lse ) { |
1782 | lse->setReadOnly( false ); | 1777 | lse->setReadOnly( false ); |
1783 | lse->setDescription( "" ); | 1778 | lse->setDescription( "" ); |
1784 | lse->setReadOnly( true ); | 1779 | lse->setReadOnly( true ); |
1785 | } | 1780 | } |
1786 | } | 1781 | } |
1787 | } else { | 1782 | } else { |
1788 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1783 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1789 | } | 1784 | } |
1790 | setModified( true ); | 1785 | setModified( true ); |
1791 | } else { | 1786 | } else { |
1792 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1787 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1793 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1788 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1794 | question, i18n("Ok")) ; | 1789 | question, i18n("Ok")) ; |
1795 | 1790 | ||
1796 | } | 1791 | } |
1797 | delete calendar; | 1792 | delete calendar; |
1798 | updateView(); | 1793 | updateView(); |
1799 | emit tempDisableBR(false); | 1794 | emit tempDisableBR(false); |
1800 | return ;//syncOK; | 1795 | return ;//syncOK; |
1801 | 1796 | ||
1802 | } | 1797 | } |
1803 | 1798 | ||
1804 | bool CalendarView::importBday() | 1799 | bool CalendarView::importBday() |
1805 | { | 1800 | { |
1806 | #ifndef KORG_NOKABC | 1801 | #ifndef KORG_NOKABC |
1807 | 1802 | ||
1808 | #ifdef DESKTOP_VERSION | 1803 | #ifdef DESKTOP_VERSION |
1809 | int curCal = mCalendar->defaultCalendar(); | 1804 | int curCal = mCalendar->defaultCalendar(); |
1810 | int bd = mCalEditView->getBirtdayID(); | 1805 | int bd = mCalEditView->getBirtdayID(); |
1811 | if ( bd == 0 ) | 1806 | if ( bd == 0 ) |
1812 | return false; | 1807 | return false; |
1813 | mCalendar->setDefaultCalendar( bd ); | 1808 | mCalendar->setDefaultCalendar( bd ); |
1814 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1809 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1815 | KABC::AddressBook::Iterator it; | 1810 | KABC::AddressBook::Iterator it; |
1816 | int count = 0; | 1811 | int count = 0; |
1817 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1812 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1818 | ++count; | 1813 | ++count; |
1819 | } | 1814 | } |
1820 | QProgressBar bar(count,0 ); | 1815 | QProgressBar bar(count,0 ); |
1821 | int w = 300; | 1816 | int w = 300; |
1822 | if ( QApplication::desktop()->width() < 320 ) | 1817 | if ( QApplication::desktop()->width() < 320 ) |
1823 | w = 220; | 1818 | w = 220; |
1824 | int h = bar.sizeHint().height() ; | 1819 | int h = bar.sizeHint().height() ; |
1825 | int dw = QApplication::desktop()->width(); | 1820 | int dw = QApplication::desktop()->width(); |
1826 | int dh = QApplication::desktop()->height(); | 1821 | int dh = QApplication::desktop()->height(); |
1827 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1822 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1828 | bar.show(); | 1823 | bar.show(); |
1829 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1824 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1830 | qApp->processEvents(); | 1825 | qApp->processEvents(); |
1831 | count = 0; | 1826 | count = 0; |
1832 | int addCount = 0; | 1827 | int addCount = 0; |
1833 | KCal::Attendee* a = 0; | 1828 | KCal::Attendee* a = 0; |
1834 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1829 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1835 | if ( ! bar.isVisible() ) | 1830 | if ( ! bar.isVisible() ) |
1836 | return false; | 1831 | return false; |
1837 | bar.setProgress( count++ ); | 1832 | bar.setProgress( count++ ); |
1838 | qApp->processEvents(); | 1833 | qApp->processEvents(); |
1839 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1834 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1840 | if ( (*it).birthday().date().isValid() ){ | 1835 | if ( (*it).birthday().date().isValid() ){ |
1841 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1836 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1842 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1837 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1843 | ++addCount; | 1838 | ++addCount; |
1844 | } | 1839 | } |
1845 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1840 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1846 | if ( anni.isValid() ){ | 1841 | if ( anni.isValid() ){ |
1847 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1842 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1848 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1843 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1849 | ++addCount; | 1844 | ++addCount; |
1850 | } | 1845 | } |
1851 | } | 1846 | } |
1852 | mCalendar->setDefaultCalendar( curCal ); | 1847 | mCalendar->setDefaultCalendar( curCal ); |
1853 | updateView(); | 1848 | updateView(); |
1854 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1849 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1855 | #else //DESKTOP_VERSION | 1850 | #else //DESKTOP_VERSION |
1856 | 1851 | ||
1857 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1852 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1858 | // the result should now arrive through method insertBirthdays | 1853 | // the result should now arrive through method insertBirthdays |
1859 | 1854 | ||
1860 | #endif //DESKTOP_VERSION | 1855 | #endif //DESKTOP_VERSION |
1861 | 1856 | ||
1862 | #endif //KORG_NOKABC | 1857 | #endif //KORG_NOKABC |
1863 | 1858 | ||
1864 | 1859 | ||
1865 | return true; | 1860 | return true; |
1866 | } | 1861 | } |
1867 | 1862 | ||
1868 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1863 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1869 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1864 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1870 | const QStringList& anniversaryList, const QStringList& realNameList, | 1865 | const QStringList& anniversaryList, const QStringList& realNameList, |
1871 | const QStringList& emailList, const QStringList& assembledNameList, | 1866 | const QStringList& emailList, const QStringList& assembledNameList, |
1872 | const QStringList& uidList) | 1867 | const QStringList& uidList) |
1873 | { | 1868 | { |
1874 | 1869 | ||
1875 | //qDebug("KO::CalendarView::insertBirthdays"); | 1870 | //qDebug("KO::CalendarView::insertBirthdays"); |
1876 | if (uid == this->name()) | 1871 | if (uid == this->name()) |
1877 | { | 1872 | { |
1878 | int curCal = mCalendar->defaultCalendar(); | 1873 | int curCal = mCalendar->defaultCalendar(); |
1879 | int bd = mCalEditView->getBirtdayID(); | 1874 | int bd = mCalEditView->getBirtdayID(); |
1880 | if ( bd == 0 ) | 1875 | if ( bd == 0 ) |
1881 | return; | 1876 | return; |
1882 | mCalendar->setDefaultCalendar( bd ); | 1877 | mCalendar->setDefaultCalendar( bd ); |
1883 | 1878 | ||
1884 | 1879 | ||
1885 | int count = birthdayList.count(); | 1880 | int count = birthdayList.count(); |
1886 | int addCount = 0; | 1881 | int addCount = 0; |
1887 | KCal::Attendee* a = 0; | 1882 | KCal::Attendee* a = 0; |
1888 | 1883 | ||
1889 | //qDebug("CalView 1 %i", count); | 1884 | //qDebug("CalView 1 %i", count); |
1890 | 1885 | ||
1891 | QProgressBar bar(count,0 ); | 1886 | QProgressBar bar(count,0 ); |
1892 | int w = 300; | 1887 | int w = 300; |
1893 | if ( QApplication::desktop()->width() < 320 ) | 1888 | if ( QApplication::desktop()->width() < 320 ) |
1894 | w = 220; | 1889 | w = 220; |
1895 | int h = bar.sizeHint().height() ; | 1890 | int h = bar.sizeHint().height() ; |
1896 | int dw = QApplication::desktop()->width(); | 1891 | int dw = QApplication::desktop()->width(); |
1897 | int dh = QApplication::desktop()->height(); | 1892 | int dh = QApplication::desktop()->height(); |
1898 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1893 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1899 | bar.show(); | 1894 | bar.show(); |
1900 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1895 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1901 | qApp->processEvents(); | 1896 | qApp->processEvents(); |
1902 | 1897 | ||
1903 | QDate birthday; | 1898 | QDate birthday; |
1904 | QDate anniversary; | 1899 | QDate anniversary; |
1905 | QString realName; | 1900 | QString realName; |
1906 | QString email; | 1901 | QString email; |
1907 | QString assembledName; | 1902 | QString assembledName; |
1908 | QString uid; | 1903 | QString uid; |
1909 | bool ok = true; | 1904 | bool ok = true; |
1910 | for ( int i = 0; i < count; i++) | 1905 | for ( int i = 0; i < count; i++) |
1911 | { | 1906 | { |
1912 | if ( ! bar.isVisible() ) | 1907 | if ( ! bar.isVisible() ) |
1913 | return; | 1908 | return; |
1914 | bar.setProgress( i ); | 1909 | bar.setProgress( i ); |
1915 | qApp->processEvents(); | 1910 | qApp->processEvents(); |
1916 | 1911 | ||
1917 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1912 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1918 | if (!ok) { | 1913 | if (!ok) { |
1919 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1914 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1920 | } | 1915 | } |
1921 | 1916 | ||
1922 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1917 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1923 | if (!ok) { | 1918 | if (!ok) { |
1924 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1919 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1925 | } | 1920 | } |
1926 | realName = realNameList[i]; | 1921 | realName = realNameList[i]; |
1927 | email = emailList[i]; | 1922 | email = emailList[i]; |
1928 | assembledName = assembledNameList[i]; | 1923 | assembledName = assembledNameList[i]; |
1929 | uid = uidList[i]; | 1924 | uid = uidList[i]; |
1930 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1925 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1931 | 1926 | ||
1932 | if ( birthday.isValid() ){ | 1927 | if ( birthday.isValid() ){ |
1933 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1928 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1934 | KCal::Attendee::ReqParticipant,uid) ; | 1929 | KCal::Attendee::ReqParticipant,uid) ; |
1935 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1930 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1936 | ++addCount; | 1931 | ++addCount; |
1937 | } | 1932 | } |
1938 | 1933 | ||
1939 | if ( anniversary.isValid() ){ | 1934 | if ( anniversary.isValid() ){ |
1940 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1935 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1941 | KCal::Attendee::ReqParticipant,uid) ; | 1936 | KCal::Attendee::ReqParticipant,uid) ; |
1942 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1937 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1943 | ++addCount; | 1938 | ++addCount; |
1944 | } | 1939 | } |
1945 | } | 1940 | } |
1946 | 1941 | ||
1947 | mCalendar->setDefaultCalendar( curCal ); | 1942 | mCalendar->setDefaultCalendar( curCal ); |
1948 | updateView(); | 1943 | updateView(); |
1949 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1944 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1950 | 1945 | ||
1951 | } | 1946 | } |
1952 | 1947 | ||
1953 | } | 1948 | } |
1954 | 1949 | ||
1955 | 1950 | ||
1956 | 1951 | ||
1957 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1952 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1958 | { | 1953 | { |
1959 | //qDebug("addAnni "); | 1954 | //qDebug("addAnni "); |
1960 | Event * ev = new Event(); | 1955 | Event * ev = new Event(); |
1961 | ev->setOrganizer(KOPrefs::instance()->email()); | 1956 | ev->setOrganizer(KOPrefs::instance()->email()); |
1962 | if ( a ) { | 1957 | if ( a ) { |
1963 | ev->addAttendee( a ); | 1958 | ev->addAttendee( a ); |
1964 | } | 1959 | } |
1965 | QString kind; | 1960 | QString kind; |
1966 | if ( birthday ) { | 1961 | if ( birthday ) { |
1967 | kind = i18n( "Birthday" ); | 1962 | kind = i18n( "Birthday" ); |
1968 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1963 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1969 | } | 1964 | } |
1970 | else { | 1965 | else { |
1971 | kind = i18n( "Anniversary" ); | 1966 | kind = i18n( "Anniversary" ); |
1972 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1967 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1973 | } | 1968 | } |
1974 | ev->setCategories( kind ); | 1969 | ev->setCategories( kind ); |
1975 | ev->setDtStart( QDateTime(date) ); | 1970 | ev->setDtStart( QDateTime(date) ); |
1976 | ev->setDtEnd( QDateTime(date) ); | 1971 | ev->setDtEnd( QDateTime(date) ); |
1977 | ev->setFloats( true ); | 1972 | ev->setFloats( true ); |
1978 | Recurrence * rec = ev->recurrence(); | 1973 | Recurrence * rec = ev->recurrence(); |
1979 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1974 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1980 | rec->addYearlyNum( date.month() ); | 1975 | rec->addYearlyNum( date.month() ); |
1981 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1976 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1982 | delete ev; | 1977 | delete ev; |
1983 | return false; | 1978 | return false; |
1984 | } | 1979 | } |
1985 | return true; | 1980 | return true; |
1986 | 1981 | ||
1987 | } | 1982 | } |
1988 | bool CalendarView::importQtopia( const QString &categories, | 1983 | bool CalendarView::importQtopia( const QString &categories, |
1989 | const QString &datebook, | 1984 | const QString &datebook, |
1990 | const QString &todolist ) | 1985 | const QString &todolist ) |
1991 | { | 1986 | { |
1992 | 1987 | ||
1993 | QtopiaFormat qtopiaFormat; | 1988 | QtopiaFormat qtopiaFormat; |
1994 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1989 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1995 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1990 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1996 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1991 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1997 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1992 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1998 | 1993 | ||
1999 | updateView(); | 1994 | updateView(); |
2000 | return true; | 1995 | return true; |
2001 | 1996 | ||
2002 | #if 0 | 1997 | #if 0 |
2003 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1998 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
2004 | mCurrentSyncDevice = "qtopia-XML"; | 1999 | mCurrentSyncDevice = "qtopia-XML"; |
2005 | if ( mSyncManager->mAskForPreferences ) | 2000 | if ( mSyncManager->mAskForPreferences ) |
2006 | edit_sync_options(); | 2001 | edit_sync_options(); |
2007 | qApp->processEvents(); | 2002 | qApp->processEvents(); |
2008 | CalendarLocal* calendar = new CalendarLocal(); | 2003 | CalendarLocal* calendar = new CalendarLocal(); |
2009 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2004 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2010 | bool syncOK = false; | 2005 | bool syncOK = false; |
2011 | QtopiaFormat qtopiaFormat; | 2006 | QtopiaFormat qtopiaFormat; |
2012 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 2007 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
2013 | bool loadOk = true; | 2008 | bool loadOk = true; |
2014 | if ( !categories.isEmpty() ) | 2009 | if ( !categories.isEmpty() ) |
2015 | loadOk = qtopiaFormat.load( calendar, categories ); | 2010 | loadOk = qtopiaFormat.load( calendar, categories ); |
2016 | if ( loadOk && !datebook.isEmpty() ) | 2011 | if ( loadOk && !datebook.isEmpty() ) |
2017 | loadOk = qtopiaFormat.load( calendar, datebook ); | 2012 | loadOk = qtopiaFormat.load( calendar, datebook ); |
2018 | if ( loadOk && !todolist.isEmpty() ) | 2013 | if ( loadOk && !todolist.isEmpty() ) |
2019 | loadOk = qtopiaFormat.load( calendar, todolist ); | 2014 | loadOk = qtopiaFormat.load( calendar, todolist ); |
2020 | 2015 | ||
2021 | if ( loadOk ) { | 2016 | if ( loadOk ) { |
2022 | getEventViewerDialog()->setSyncMode( true ); | 2017 | getEventViewerDialog()->setSyncMode( true ); |
2023 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 2018 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
2024 | getEventViewerDialog()->setSyncMode( false ); | 2019 | getEventViewerDialog()->setSyncMode( false ); |
2025 | qApp->processEvents(); | 2020 | qApp->processEvents(); |
2026 | if ( syncOK ) { | 2021 | if ( syncOK ) { |
2027 | if ( mSyncManager->mWriteBackFile ) | 2022 | if ( mSyncManager->mWriteBackFile ) |
2028 | { | 2023 | { |
2029 | // write back XML file | 2024 | // write back XML file |
2030 | 2025 | ||
2031 | } | 2026 | } |
2032 | setModified( true ); | 2027 | setModified( true ); |
2033 | } | 2028 | } |
2034 | } else { | 2029 | } else { |
2035 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 2030 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
2036 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 2031 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
2037 | question, i18n("Ok")) ; | 2032 | question, i18n("Ok")) ; |
2038 | } | 2033 | } |
2039 | delete calendar; | 2034 | delete calendar; |
2040 | updateView(); | 2035 | updateView(); |
2041 | return syncOK; | 2036 | return syncOK; |
2042 | 2037 | ||
2043 | 2038 | ||
2044 | #endif | 2039 | #endif |
2045 | 2040 | ||
2046 | } | 2041 | } |
2047 | 2042 | ||
2048 | void CalendarView::setSyncEventsReadOnly() | 2043 | void CalendarView::setSyncEventsReadOnly() |
2049 | { | 2044 | { |
2050 | mCalendar->setSyncEventsReadOnly(); | 2045 | mCalendar->setSyncEventsReadOnly(); |
2051 | } | 2046 | } |
2052 | 2047 | ||
2053 | bool CalendarView::loadCalendars() | 2048 | bool CalendarView::loadCalendars() |
2054 | { | 2049 | { |
2055 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2050 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2056 | KopiCalendarFile * cal = calendars.first(); | 2051 | KopiCalendarFile * cal = calendars.first(); |
2057 | mCalendar->setDefaultCalendar( 1 ); | 2052 | mCalendar->setDefaultCalendar( 1 ); |
2058 | openCalendar( MainWindow::defaultFileName(), false ); | 2053 | openCalendar( MainWindow::defaultFileName(), false ); |
2059 | cal = calendars.next(); | 2054 | cal = calendars.next(); |
2060 | while ( cal ) { | 2055 | while ( cal ) { |
2061 | addCalendar( cal ); | 2056 | addCalendar( cal ); |
2062 | cal = calendars.next(); | 2057 | cal = calendars.next(); |
2063 | } | 2058 | } |
2064 | restoreCalendarSettings(); | 2059 | restoreCalendarSettings(); |
2065 | return true; | 2060 | return true; |
2066 | } | 2061 | } |
2067 | bool CalendarView::restoreCalendarSettings() | 2062 | bool CalendarView::restoreCalendarSettings() |
2068 | { | 2063 | { |
2069 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2064 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2070 | KopiCalendarFile * cal = calendars.first(); | 2065 | KopiCalendarFile * cal = calendars.first(); |
2071 | while ( cal ) { | 2066 | while ( cal ) { |
2072 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 2067 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
2073 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 2068 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
2074 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 2069 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
2075 | if ( cal->isStandard ) | 2070 | if ( cal->isStandard ) |
2076 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2071 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2077 | cal = calendars.next(); | 2072 | cal = calendars.next(); |
2078 | } | 2073 | } |
2079 | setSyncEventsReadOnly(); | 2074 | setSyncEventsReadOnly(); |
2080 | mCalendar->reInitAlarmSettings(); | 2075 | mCalendar->reInitAlarmSettings(); |
2081 | updateUnmanagedViews(); | 2076 | updateUnmanagedViews(); |
2082 | updateView(); | 2077 | updateView(); |
2083 | return true; | 2078 | return true; |
2084 | } | 2079 | } |
2085 | void CalendarView::addCalendarId( int id ) | 2080 | void CalendarView::addCalendarId( int id ) |
2086 | { | 2081 | { |
2087 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); | 2082 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); |
2088 | if ( cal ) | 2083 | if ( cal ) |
2089 | addCalendar( cal ); | 2084 | addCalendar( cal ); |
2090 | } | 2085 | } |
2091 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) | 2086 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) |
2092 | { | 2087 | { |
2093 | cal->mErrorOnLoad = false; | 2088 | cal->mErrorOnLoad = false; |
2094 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { | 2089 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { |
2095 | cal->mLoadDt = QDateTime::currentDateTime(); | 2090 | cal->mLoadDt = QDateTime::currentDateTime(); |
2096 | return true; | 2091 | return true; |
2097 | } | 2092 | } |
2098 | qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() ); | 2093 | qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() ); |
2099 | cal->mErrorOnLoad = true; | 2094 | cal->mErrorOnLoad = true; |
2100 | return false; | 2095 | return false; |
2101 | } | 2096 | } |
2102 | bool CalendarView::openCalendar(QString filename, bool merge) | 2097 | bool CalendarView::openCalendar(QString filename, bool merge) |
2103 | { | 2098 | { |
2104 | 2099 | ||
2105 | if (filename.isEmpty()) { | 2100 | if (filename.isEmpty()) { |
2106 | return false; | 2101 | return false; |
2107 | } | 2102 | } |
2108 | 2103 | ||
2109 | if (!QFile::exists(filename)) { | 2104 | if (!QFile::exists(filename)) { |
2110 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 2105 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
2111 | return false; | 2106 | return false; |
2112 | } | 2107 | } |
2113 | 2108 | ||
2114 | globalFlagBlockAgenda = 1; | 2109 | globalFlagBlockAgenda = 1; |
2115 | clearAllViews(); | 2110 | clearAllViews(); |
2116 | if (!merge) { | 2111 | if (!merge) { |
2117 | mViewManager->setDocumentId( filename ); | 2112 | mViewManager->setDocumentId( filename ); |
2118 | mCalendar->close(); | 2113 | mCalendar->close(); |
2119 | } | 2114 | } |
2120 | mStorage->setFileName( filename ); | 2115 | mStorage->setFileName( filename ); |
2121 | 2116 | ||
2122 | if ( mStorage->load() ) { | 2117 | if ( mStorage->load() ) { |
2123 | if ( merge ) ;//setModified( true ); | 2118 | if ( merge ) ;//setModified( true ); |
2124 | else { | 2119 | else { |
2125 | //setModified( true ); | 2120 | //setModified( true ); |
2126 | mViewManager->setDocumentId( filename ); | 2121 | mViewManager->setDocumentId( filename ); |
2127 | mDialogManager->setDocumentId( filename ); | 2122 | mDialogManager->setDocumentId( filename ); |
2128 | mTodoList->setDocumentId( filename ); | 2123 | mTodoList->setDocumentId( filename ); |
2129 | } | 2124 | } |
2130 | globalFlagBlockAgenda = 2; | 2125 | globalFlagBlockAgenda = 2; |
2131 | // if ( getLastSyncEvent() ) | 2126 | // if ( getLastSyncEvent() ) |
2132 | // getLastSyncEvent()->setReadOnly( true ); | 2127 | // getLastSyncEvent()->setReadOnly( true ); |
2133 | mCalendar->reInitAlarmSettings(); | 2128 | mCalendar->reInitAlarmSettings(); |
2134 | setSyncEventsReadOnly(); | 2129 | setSyncEventsReadOnly(); |
2135 | updateUnmanagedViews(); | 2130 | updateUnmanagedViews(); |
2136 | updateView(); | 2131 | updateView(); |
2137 | if ( filename != MainWindow::defaultFileName() ) { | 2132 | if ( filename != MainWindow::defaultFileName() ) { |
2138 | saveCalendar( MainWindow::defaultFileName() ); | 2133 | saveCalendar( MainWindow::defaultFileName() ); |
2139 | } else { | 2134 | } else { |
2140 | QFileInfo finf ( MainWindow::defaultFileName()); | 2135 | QFileInfo finf ( MainWindow::defaultFileName()); |
2141 | if ( finf.exists() ) { | 2136 | if ( finf.exists() ) { |
2142 | setLoadedFileVersion( finf.lastModified () ); | 2137 | setLoadedFileVersion( finf.lastModified () ); |
2143 | } | 2138 | } |
2144 | } | 2139 | } |
2145 | return true; | 2140 | return true; |
2146 | } else { | 2141 | } else { |
2147 | // while failing to load, the calendar object could | 2142 | // while failing to load, the calendar object could |
2148 | // have become partially populated. Clear it out. | 2143 | // have become partially populated. Clear it out. |
2149 | if ( !merge ) { | 2144 | if ( !merge ) { |
2150 | mCalendar->close(); | 2145 | mCalendar->close(); |
2151 | mViewManager->setDocumentId( filename ); | 2146 | mViewManager->setDocumentId( filename ); |
2152 | mDialogManager->setDocumentId( filename ); | 2147 | mDialogManager->setDocumentId( filename ); |
2153 | mTodoList->setDocumentId( filename ); | 2148 | mTodoList->setDocumentId( filename ); |
2154 | } | 2149 | } |
2155 | 2150 | ||
2156 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 2151 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
2157 | 2152 | ||
2158 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 2153 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
2159 | globalFlagBlockAgenda = 2; | 2154 | globalFlagBlockAgenda = 2; |
2160 | mCalendar->reInitAlarmSettings(); | 2155 | mCalendar->reInitAlarmSettings(); |
2161 | setSyncEventsReadOnly(); | 2156 | setSyncEventsReadOnly(); |
2162 | updateUnmanagedViews(); | 2157 | updateUnmanagedViews(); |
2163 | updateView(); | 2158 | updateView(); |
2164 | } | 2159 | } |
2165 | return false; | 2160 | return false; |
2166 | } | 2161 | } |
2167 | void CalendarView::mergeFile( QString fn ) | 2162 | void CalendarView::mergeFile( QString fn ) |
2168 | { | 2163 | { |
2169 | clearAllViews(); | 2164 | clearAllViews(); |
2170 | mCalendar->mergeCalendarFile( fn ); | 2165 | mCalendar->mergeCalendarFile( fn ); |
2171 | mCalendar->reInitAlarmSettings(); | 2166 | mCalendar->reInitAlarmSettings(); |
2172 | setSyncEventsReadOnly(); | 2167 | setSyncEventsReadOnly(); |
2173 | updateUnmanagedViews(); | 2168 | updateUnmanagedViews(); |
2174 | updateView(); | 2169 | updateView(); |
2175 | } | 2170 | } |
2176 | void CalendarView::showOpenError() | 2171 | void CalendarView::showOpenError() |
2177 | { | 2172 | { |
2178 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 2173 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
2179 | } | 2174 | } |
2180 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 2175 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
2181 | { | 2176 | { |
2182 | loadedFileVersion = dt; | 2177 | loadedFileVersion = dt; |
2183 | } | 2178 | } |
2184 | bool CalendarView::checkFileChanged(QString fn) | 2179 | bool CalendarView::checkFileChanged(QString fn) |
2185 | { | 2180 | { |
2186 | QFileInfo finf ( fn ); | 2181 | QFileInfo finf ( fn ); |
2187 | if ( !finf.exists() ) | 2182 | if ( !finf.exists() ) |
2188 | return true; | 2183 | return true; |
2189 | QDateTime dt = finf.lastModified (); | 2184 | QDateTime dt = finf.lastModified (); |
2190 | if ( dt <= loadedFileVersion ) | 2185 | if ( dt <= loadedFileVersion ) |
2191 | return false; | 2186 | return false; |
2192 | return true; | 2187 | return true; |
2193 | 2188 | ||
2194 | } | 2189 | } |
2195 | void CalendarView::watchSavedFile() | 2190 | void CalendarView::watchSavedFile() |
2196 | { | 2191 | { |
2197 | QFileInfo finf ( MainWindow::defaultFileName()); | 2192 | QFileInfo finf ( MainWindow::defaultFileName()); |
2198 | if ( !finf.exists() ) | 2193 | if ( !finf.exists() ) |
2199 | return; | 2194 | return; |
2200 | QDateTime dt = finf.lastModified (); | 2195 | QDateTime dt = finf.lastModified (); |
2201 | if ( dt < loadedFileVersion ) { | 2196 | if ( dt < loadedFileVersion ) { |
2202 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 2197 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
2203 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 2198 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
2204 | return; | 2199 | return; |
2205 | } | 2200 | } |
2206 | loadedFileVersion = dt; | 2201 | loadedFileVersion = dt; |
2207 | } | 2202 | } |
2208 | bool CalendarView::checkAllFileVersions() | 2203 | bool CalendarView::checkAllFileVersions() |
2209 | { | 2204 | { |
2210 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2205 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2211 | KopiCalendarFile * cal = calendars.first(); | 2206 | KopiCalendarFile * cal = calendars.first(); |
2212 | mCalendar->setDefaultCalendar( 1 ); | 2207 | mCalendar->setDefaultCalendar( 1 ); |
2213 | mCalendar->setDefaultCalendarEnabledOnly(); | 2208 | mCalendar->setDefaultCalendarEnabledOnly(); |
2214 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2209 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2215 | if ( !checkFileVersion(MainWindow::defaultFileName())) { | 2210 | if ( !checkFileVersion(MainWindow::defaultFileName())) { |
2216 | restoreCalendarSettings(); | 2211 | restoreCalendarSettings(); |
2217 | return false; | 2212 | return false; |
2218 | } | 2213 | } |
2219 | } | 2214 | } |
2220 | cal = calendars.next(); | 2215 | cal = calendars.next(); |
2221 | QDateTime storeTemp = loadedFileVersion; | 2216 | QDateTime storeTemp = loadedFileVersion; |
2222 | while ( cal ) { | 2217 | while ( cal ) { |
2223 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2218 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2224 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2219 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2225 | mCalendar->setDefaultCalendarEnabledOnly(); | 2220 | mCalendar->setDefaultCalendarEnabledOnly(); |
2226 | loadedFileVersion = cal->mLoadDt.addSecs( 15 ); | 2221 | loadedFileVersion = cal->mLoadDt.addSecs( 15 ); |
2227 | if ( !checkFileVersion(cal->mFileName )) { | 2222 | if ( !checkFileVersion(cal->mFileName )) { |
2228 | loadedFileVersion = storeTemp; | 2223 | loadedFileVersion = storeTemp; |
2229 | restoreCalendarSettings(); | 2224 | restoreCalendarSettings(); |
2230 | return false; | 2225 | return false; |
2231 | } | 2226 | } |
2232 | } | 2227 | } |
2233 | cal = calendars.next(); | 2228 | cal = calendars.next(); |
2234 | } | 2229 | } |
2235 | loadedFileVersion = storeTemp; | 2230 | loadedFileVersion = storeTemp; |
2236 | return true; | 2231 | return true; |
2237 | } | 2232 | } |
2238 | bool CalendarView::checkFileVersion(QString fn) | 2233 | bool CalendarView::checkFileVersion(QString fn) |
2239 | { | 2234 | { |
2240 | QFileInfo finf ( fn ); | 2235 | QFileInfo finf ( fn ); |
2241 | if ( !finf.exists() ) | 2236 | if ( !finf.exists() ) |
2242 | return true; | 2237 | return true; |
2243 | QDateTime dt = finf.lastModified (); | 2238 | QDateTime dt = finf.lastModified (); |
2244 | qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); | 2239 | qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); |
2245 | qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); | 2240 | qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); |
2246 | if ( dt <= loadedFileVersion ) | 2241 | if ( dt <= loadedFileVersion ) |
2247 | return true; | 2242 | return true; |
2248 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(KGlobal::formatMessage(fn,0)).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 2243 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(KGlobal::formatMessage(fn,0)).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
2249 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 2244 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
2250 | i18n("Sync+save")); | 2245 | i18n("Sync+save")); |
2251 | 2246 | ||
2252 | if ( km == KMessageBox::Cancel ) | 2247 | if ( km == KMessageBox::Cancel ) |
2253 | return false; | 2248 | return false; |
2254 | if ( km == KMessageBox::Yes ) | 2249 | if ( km == KMessageBox::Yes ) |
2255 | return true; | 2250 | return true; |
2256 | 2251 | ||
2257 | setSyncDevice("deleteaftersync" ); | 2252 | setSyncDevice("deleteaftersync" ); |
2258 | mSyncManager->mAskForPreferences = true; | 2253 | mSyncManager->mAskForPreferences = true; |
2259 | mSyncManager->mSyncAlgoPrefs = 3; | 2254 | mSyncManager->mSyncAlgoPrefs = 3; |
2260 | mSyncManager->mWriteBackFile = false; | 2255 | mSyncManager->mWriteBackFile = false; |
2261 | mSyncManager->mWriteBackExistingOnly = false; | 2256 | mSyncManager->mWriteBackExistingOnly = false; |
2262 | mSyncManager->mShowSyncSummary = false; | 2257 | mSyncManager->mShowSyncSummary = false; |
2263 | syncCalendar( fn, 3 ); | 2258 | syncCalendar( fn, 3 ); |
2264 | Event * e = getLastSyncEvent(); | 2259 | Event * e = getLastSyncEvent(); |
2265 | if ( e ) | 2260 | if ( e ) |
2266 | mCalendar->deleteEvent( e ); | 2261 | mCalendar->deleteEvent( e ); |
2267 | return true; | 2262 | return true; |
2268 | } | 2263 | } |
2269 | bool CalendarView::saveCalendars() | 2264 | bool CalendarView::saveCalendars() |
2270 | { | 2265 | { |
2271 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2266 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2272 | KopiCalendarFile * cal = calendars.first(); | 2267 | KopiCalendarFile * cal = calendars.first(); |
2273 | mCalendar->setDefaultCalendar( 1 ); | 2268 | mCalendar->setDefaultCalendar( 1 ); |
2274 | mCalendar->setDefaultCalendarEnabledOnly(); | 2269 | mCalendar->setDefaultCalendarEnabledOnly(); |
2275 | saveCalendar( MainWindow::defaultFileName() ); | 2270 | saveCalendar( MainWindow::defaultFileName() ); |
2276 | cal = calendars.next(); | 2271 | cal = calendars.next(); |
2277 | while ( cal ) { | 2272 | while ( cal ) { |
2278 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2273 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2279 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2274 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2280 | mCalendar->setDefaultCalendarEnabledOnly(); | 2275 | mCalendar->setDefaultCalendarEnabledOnly(); |
2281 | if ( saveCalendar( cal->mFileName ) ) | 2276 | if ( saveCalendar( cal->mFileName ) ) |
2282 | cal->mLoadDt = QDateTime::currentDateTime(); | 2277 | cal->mLoadDt = QDateTime::currentDateTime(); |
2283 | } | 2278 | } |
2284 | cal = calendars.next(); | 2279 | cal = calendars.next(); |
2285 | } | 2280 | } |
2286 | restoreCalendarSettings(); | 2281 | restoreCalendarSettings(); |
2287 | return true; | 2282 | return true; |
2288 | } | 2283 | } |
2289 | bool CalendarView::saveCalendar( QString filename ) | 2284 | bool CalendarView::saveCalendar( QString filename ) |
2290 | { | 2285 | { |
2291 | 2286 | ||
2292 | // Store back all unsaved data into calendar object | 2287 | // Store back all unsaved data into calendar object |
2293 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 2288 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
2294 | if ( mViewManager->currentView() ) | 2289 | if ( mViewManager->currentView() ) |
2295 | mViewManager->currentView()->flushView(); | 2290 | mViewManager->currentView()->flushView(); |
2296 | 2291 | ||
2297 | 2292 | ||
2298 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 2293 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
2299 | mStorage->setSaveFormat( new ICalFormat() ); | 2294 | mStorage->setSaveFormat( new ICalFormat() ); |
2300 | mStorage->setFileName( filename ); | 2295 | mStorage->setFileName( filename ); |
2301 | bool success; | 2296 | bool success; |
2302 | success = mStorage->save(); | 2297 | success = mStorage->save(); |
2303 | if ( !success ) { | 2298 | if ( !success ) { |
2304 | return false; | 2299 | return false; |
2305 | } | 2300 | } |
2306 | if ( filename == MainWindow::defaultFileName() ) { | 2301 | if ( filename == MainWindow::defaultFileName() ) { |
2307 | setLoadedFileVersion( lfv ); | 2302 | setLoadedFileVersion( lfv ); |
2308 | watchSavedFile(); | 2303 | watchSavedFile(); |
2309 | } | 2304 | } |
2310 | return true; | 2305 | return true; |
2311 | } | 2306 | } |
2312 | 2307 | ||
2313 | void CalendarView::closeCalendar() | 2308 | void CalendarView::closeCalendar() |
2314 | { | 2309 | { |
2315 | 2310 | ||
2316 | // child windows no longer valid | 2311 | // child windows no longer valid |
2317 | clearAllViews(); | 2312 | clearAllViews(); |
2318 | emit closingDown(); | 2313 | emit closingDown(); |
2319 | 2314 | ||
2320 | mCalendar->close(); | 2315 | mCalendar->close(); |
2321 | setModified(false); | 2316 | setModified(false); |
2322 | updateView(); | 2317 | updateView(); |
2323 | } | 2318 | } |
2324 | 2319 | ||
2325 | void CalendarView::archiveCalendar() | 2320 | void CalendarView::archiveCalendar() |
2326 | { | 2321 | { |
2327 | mDialogManager->showArchiveDialog(); | 2322 | mDialogManager->showArchiveDialog(); |
2328 | } | 2323 | } |
2329 | 2324 | ||
2330 | 2325 | ||
2331 | void CalendarView::readSettings() | 2326 | void CalendarView::readSettings() |
2332 | { | 2327 | { |
2333 | 2328 | ||
2334 | 2329 | ||
2335 | // mViewManager->showAgendaView(); | 2330 | // mViewManager->showAgendaView(); |
2336 | QString str; | 2331 | QString str; |
2337 | //qDebug("CalendarView::readSettings() "); | 2332 | //qDebug("CalendarView::readSettings() "); |
2338 | // read settings from the KConfig, supplying reasonable | 2333 | // read settings from the KConfig, supplying reasonable |
2339 | // defaults where none are to be found | 2334 | // defaults where none are to be found |
2340 | KConfig *config = KOGlobals::config(); | 2335 | KConfig *config = KOGlobals::config(); |
2341 | #ifndef KORG_NOSPLITTER | 2336 | #ifndef KORG_NOSPLITTER |
2342 | config->setGroup("KOrganizer Geometry"); | 2337 | config->setGroup("KOrganizer Geometry"); |
2343 | 2338 | ||
2344 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 2339 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
2345 | if (sizes.count() != 2) { | 2340 | if (sizes.count() != 2) { |
2346 | sizes << mDateNavigator->minimumSizeHint().width(); | 2341 | sizes << mDateNavigator->minimumSizeHint().width(); |
2347 | sizes << 300; | 2342 | sizes << 300; |
2348 | } | 2343 | } |
2349 | mPanner->setSizes(sizes); | 2344 | mPanner->setSizes(sizes); |
2350 | 2345 | ||
2351 | sizes = config->readIntListEntry("Separator2"); | 2346 | sizes = config->readIntListEntry("Separator2"); |
2352 | if ( ( mResourceView && sizes.count() == 4 ) || | 2347 | if ( ( mResourceView && sizes.count() == 4 ) || |
2353 | ( !mResourceView && sizes.count() == 3 ) ) { | 2348 | ( !mResourceView && sizes.count() == 3 ) ) { |
2354 | mLeftSplitter->setSizes(sizes); | 2349 | mLeftSplitter->setSizes(sizes); |
2355 | } | 2350 | } |
2356 | #endif | 2351 | #endif |
2357 | globalFlagBlockAgenda = 1; | 2352 | globalFlagBlockAgenda = 1; |
2358 | mViewManager->showAgendaView(); | 2353 | mViewManager->showAgendaView(); |
2359 | //mViewManager->readSettings( config ); | 2354 | //mViewManager->readSettings( config ); |
2360 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2355 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2361 | readFilterSettings(config); | 2356 | readFilterSettings(config); |
2362 | 2357 | ||
2363 | #ifdef DESKTOP_VERSION | 2358 | #ifdef DESKTOP_VERSION |
2364 | config->setGroup("WidgetLayout"); | 2359 | config->setGroup("WidgetLayout"); |
2365 | QStringList list; | 2360 | QStringList list; |
2366 | list = config->readListEntry("MainLayout"); | 2361 | list = config->readListEntry("MainLayout"); |
2367 | int x,y,w,h; | 2362 | int x,y,w,h; |
2368 | if ( ! list.isEmpty() ) { | 2363 | if ( ! list.isEmpty() ) { |
2369 | x = list[0].toInt(); | 2364 | x = list[0].toInt(); |
2370 | y = list[1].toInt(); | 2365 | y = list[1].toInt(); |
2371 | w = list[2].toInt(); | 2366 | w = list[2].toInt(); |
2372 | h = list[3].toInt(); | 2367 | h = list[3].toInt(); |
2373 | KApplication::testCoords( &x,&y,&w,&h ); | 2368 | KApplication::testCoords( &x,&y,&w,&h ); |
2374 | topLevelWidget()->setGeometry(x,y,w,h); | 2369 | topLevelWidget()->setGeometry(x,y,w,h); |
2375 | 2370 | ||
2376 | } else { | 2371 | } else { |
2377 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2372 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2378 | } | 2373 | } |
2379 | list = config->readListEntry("EditEventLayout"); | 2374 | list = config->readListEntry("EditEventLayout"); |
2380 | if ( ! list.isEmpty() ) { | 2375 | if ( ! list.isEmpty() ) { |
2381 | x = list[0].toInt(); | 2376 | x = list[0].toInt(); |
2382 | y = list[1].toInt(); | 2377 | y = list[1].toInt(); |
2383 | w = list[2].toInt(); | 2378 | w = list[2].toInt(); |
2384 | h = list[3].toInt(); | 2379 | h = list[3].toInt(); |
2385 | KApplication::testCoords( &x,&y,&w,&h ); | 2380 | KApplication::testCoords( &x,&y,&w,&h ); |
2386 | mEventEditor->setGeometry(x,y,w,h); | 2381 | mEventEditor->setGeometry(x,y,w,h); |
2387 | 2382 | ||
2388 | } | 2383 | } |
2389 | list = config->readListEntry("EditTodoLayout"); | 2384 | list = config->readListEntry("EditTodoLayout"); |
2390 | if ( ! list.isEmpty() ) { | 2385 | if ( ! list.isEmpty() ) { |
2391 | x = list[0].toInt(); | 2386 | x = list[0].toInt(); |
2392 | y = list[1].toInt(); | 2387 | y = list[1].toInt(); |
2393 | w = list[2].toInt(); | 2388 | w = list[2].toInt(); |
2394 | h = list[3].toInt(); | 2389 | h = list[3].toInt(); |
2395 | KApplication::testCoords( &x,&y,&w,&h ); | 2390 | KApplication::testCoords( &x,&y,&w,&h ); |
2396 | mTodoEditor->setGeometry(x,y,w,h); | 2391 | mTodoEditor->setGeometry(x,y,w,h); |
2397 | 2392 | ||
2398 | } | 2393 | } |
2399 | list = config->readListEntry("ViewerLayout"); | 2394 | list = config->readListEntry("ViewerLayout"); |
2400 | if ( ! list.isEmpty() ) { | 2395 | if ( ! list.isEmpty() ) { |
2401 | x = list[0].toInt(); | 2396 | x = list[0].toInt(); |
2402 | y = list[1].toInt(); | 2397 | y = list[1].toInt(); |
2403 | w = list[2].toInt(); | 2398 | w = list[2].toInt(); |
2404 | h = list[3].toInt(); | 2399 | h = list[3].toInt(); |
2405 | KApplication::testCoords( &x,&y,&w,&h ); | 2400 | KApplication::testCoords( &x,&y,&w,&h ); |
2406 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2401 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2407 | } | 2402 | } |
2408 | #endif | 2403 | #endif |
2409 | config->setGroup( "Views" ); | 2404 | config->setGroup( "Views" ); |
2410 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2405 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2411 | 2406 | ||
2412 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2407 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2413 | 2408 | ||
2414 | int resetval = 0; | 2409 | int resetval = 0; |
2415 | int maxVal = 0; | 2410 | int maxVal = 0; |
2416 | if (sizes.count() != 3) { | 2411 | if (sizes.count() != 3) { |
2417 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2412 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2418 | resetval = mDateNavigator->sizeHint().width()+2; | 2413 | resetval = mDateNavigator->sizeHint().width()+2; |
2419 | } else { | 2414 | } else { |
2420 | resetval = mDateNavigator->sizeHint().height()+2; | 2415 | resetval = mDateNavigator->sizeHint().height()+2; |
2421 | } | 2416 | } |
2422 | } | 2417 | } |
2423 | if ( resetval ) { | 2418 | if ( resetval ) { |
2424 | sizes.clear(); | 2419 | sizes.clear(); |
2425 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2420 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2426 | maxVal = QApplication::desktop()->width() -10; | 2421 | maxVal = QApplication::desktop()->width() -10; |
2427 | } else { | 2422 | } else { |
2428 | maxVal = QApplication::desktop()->height()-10; | 2423 | maxVal = QApplication::desktop()->height()-10; |
2429 | } | 2424 | } |
2430 | sizes << resetval; | 2425 | sizes << resetval; |
2431 | if ( maxVal < resetval + resetval) | 2426 | if ( maxVal < resetval + resetval) |
2432 | resetval = maxVal - resetval; | 2427 | resetval = maxVal - resetval; |
2433 | sizes << resetval; | 2428 | sizes << resetval; |
2434 | sizes << 100; | 2429 | sizes << 100; |
2435 | } | 2430 | } |
2436 | mLeftFrame->setSizes(sizes); | 2431 | mLeftFrame->setSizes(sizes); |
2437 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2432 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2438 | resetval = 0; | 2433 | resetval = 0; |
2439 | maxVal = 0; | 2434 | maxVal = 0; |
2440 | if (sizes.count() != 2) { | 2435 | if (sizes.count() != 2) { |
2441 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2436 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2442 | resetval = mDateNavigator->sizeHint().width()+2; | 2437 | resetval = mDateNavigator->sizeHint().width()+2; |
2443 | } else { | 2438 | } else { |
2444 | resetval = mDateNavigator->sizeHint().height()+2; | 2439 | resetval = mDateNavigator->sizeHint().height()+2; |
2445 | } | 2440 | } |
2446 | } | 2441 | } |
2447 | if ( resetval ) { | 2442 | if ( resetval ) { |
2448 | sizes.clear(); | 2443 | sizes.clear(); |
2449 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2444 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2450 | maxVal = QApplication::desktop()->width() -10; | 2445 | maxVal = QApplication::desktop()->width() -10; |
2451 | } else { | 2446 | } else { |
2452 | maxVal = QApplication::desktop()->height()-10; | 2447 | maxVal = QApplication::desktop()->height()-10; |
2453 | } | 2448 | } |
2454 | sizes << resetval; | 2449 | sizes << resetval; |
2455 | if ( maxVal < resetval + resetval) | 2450 | if ( maxVal < resetval + resetval) |
2456 | resetval = maxVal - resetval; | 2451 | resetval = maxVal - resetval; |
2457 | sizes << resetval; | 2452 | sizes << resetval; |
2458 | } | 2453 | } |
2459 | mMainFrame->setSizes(sizes); | 2454 | mMainFrame->setSizes(sizes); |
2460 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2455 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2461 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2456 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2462 | else mNavigator->selectDates( dateCount ); | 2457 | else mNavigator->selectDates( dateCount ); |
2463 | // mViewManager->readSettings( config ); | 2458 | // mViewManager->readSettings( config ); |
2464 | updateConfig(); | 2459 | updateConfig(); |
2465 | globalFlagBlockAgenda = 2; | 2460 | globalFlagBlockAgenda = 2; |
2466 | mViewManager->readSettings( config ); | 2461 | mViewManager->readSettings( config ); |
2467 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2462 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2468 | } | 2463 | } |
2469 | 2464 | ||
2470 | void CalendarView::checkSuspendAlarm() | 2465 | void CalendarView::checkSuspendAlarm() |
2471 | { | 2466 | { |
2472 | if ( mSuspendTimer->isActive() ) { | 2467 | if ( mSuspendTimer->isActive() ) { |
2473 | KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm")); | 2468 | KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm")); |
2474 | } | 2469 | } |
2475 | } | 2470 | } |
2476 | void CalendarView::writeSettings() | 2471 | void CalendarView::writeSettings() |
2477 | { | 2472 | { |
2478 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2473 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2479 | 2474 | ||
2480 | KConfig *config = KOGlobals::config(); | 2475 | KConfig *config = KOGlobals::config(); |
2481 | 2476 | ||
2482 | mViewManager->writeSettings( config ); | 2477 | mViewManager->writeSettings( config ); |
2483 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2478 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2484 | mDialogManager->writeSettings( config ); | 2479 | mDialogManager->writeSettings( config ); |
2485 | //KOPrefs::instance()->usrWriteConfig(); | 2480 | //KOPrefs::instance()->usrWriteConfig(); |
2486 | KOPrefs::instance()->writeConfig(); | 2481 | KOPrefs::instance()->writeConfig(); |
2487 | 2482 | ||
2488 | writeFilterSettings(config); | 2483 | writeFilterSettings(config); |
2489 | config->setGroup( "AppRun" ); | 2484 | config->setGroup( "AppRun" ); |
2490 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2485 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2491 | int days = dt.daysTo( QDate::currentDate() ); | 2486 | int days = dt.daysTo( QDate::currentDate() ); |
2492 | dt = dt.addDays( days ); | 2487 | dt = dt.addDays( days ); |
2493 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2488 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2494 | config->writeEntry( "LatestProgramStopDays", days ); | 2489 | config->writeEntry( "LatestProgramStopDays", days ); |
2495 | config->writeEntry( "LatestProgramStopSecs", secs ); | 2490 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2496 | //qDebug("KO: Writing stop time: %d ", secs); | 2491 | //qDebug("KO: Writing stop time: %d ", secs); |
2497 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2492 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2498 | //QDateTime latest = dt.addSecs ( secs ); | 2493 | //QDateTime latest = dt.addSecs ( secs ); |
2499 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | 2494 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); |
2500 | config->setGroup( "Views" ); | 2495 | config->setGroup( "Views" ); |
2501 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2496 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2502 | 2497 | ||
2503 | #if 0 | 2498 | #if 0 |
2504 | qDebug("********************* "); | 2499 | qDebug("********************* "); |
2505 | qDebug("Testcode secsto "); | 2500 | qDebug("Testcode secsto "); |
2506 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | 2501 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); |
2507 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | 2502 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); |
2508 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | 2503 | int secsto = dt_nodaylight.secsTo( dt_daylight ); |
2509 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | 2504 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); |
2510 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | 2505 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); |
2511 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | 2506 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); |
2512 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | 2507 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); |
2513 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | 2508 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); |
2514 | qDebug("********************* testcode end"); | 2509 | qDebug("********************* testcode end"); |
2515 | 2510 | ||
2516 | #endif | 2511 | #endif |
2517 | 2512 | ||
2518 | QValueList<int> listINT = mLeftFrame->sizes(); | 2513 | QValueList<int> listINT = mLeftFrame->sizes(); |
2519 | config->writeEntry("Left Splitter Frame",listINT); | 2514 | config->writeEntry("Left Splitter Frame",listINT); |
2520 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2515 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2521 | config->writeEntry("Main Splitter Frame",listINT2); | 2516 | config->writeEntry("Main Splitter Frame",listINT2); |
2522 | #ifdef DESKTOP_VERSION | 2517 | #ifdef DESKTOP_VERSION |
2523 | config->setGroup("WidgetLayout"); | 2518 | config->setGroup("WidgetLayout"); |
2524 | QStringList list ;//= config->readListEntry("MainLayout"); | 2519 | QStringList list ;//= config->readListEntry("MainLayout"); |
2525 | int x,y,w,h; | 2520 | int x,y,w,h; |
2526 | QWidget* wid; | 2521 | QWidget* wid; |
2527 | wid = topLevelWidget(); | 2522 | wid = topLevelWidget(); |
2528 | x = wid->geometry().x(); | 2523 | x = wid->geometry().x(); |
2529 | y = wid->geometry().y(); | 2524 | y = wid->geometry().y(); |
2530 | w = wid->width(); | 2525 | w = wid->width(); |
2531 | h = wid->height(); | 2526 | h = wid->height(); |
2532 | list.clear(); | 2527 | list.clear(); |
2533 | list << QString::number( x ); | 2528 | list << QString::number( x ); |
2534 | list << QString::number( y ); | 2529 | list << QString::number( y ); |
2535 | list << QString::number( w ); | 2530 | list << QString::number( w ); |
2536 | list << QString::number( h ); | 2531 | list << QString::number( h ); |
2537 | config->writeEntry("MainLayout",list ); | 2532 | config->writeEntry("MainLayout",list ); |
2538 | 2533 | ||
2539 | wid = mEventEditor; | 2534 | wid = mEventEditor; |
2540 | x = wid->geometry().x(); | 2535 | x = wid->geometry().x(); |
2541 | y = wid->geometry().y(); | 2536 | y = wid->geometry().y(); |
2542 | w = wid->width(); | 2537 | w = wid->width(); |
2543 | h = wid->height(); | 2538 | h = wid->height(); |
2544 | list.clear(); | 2539 | list.clear(); |
2545 | list << QString::number( x ); | 2540 | list << QString::number( x ); |
2546 | list << QString::number( y ); | 2541 | list << QString::number( y ); |
2547 | list << QString::number( w ); | 2542 | list << QString::number( w ); |
2548 | list << QString::number( h ); | 2543 | list << QString::number( h ); |
2549 | config->writeEntry("EditEventLayout",list ); | 2544 | config->writeEntry("EditEventLayout",list ); |
2550 | 2545 | ||
2551 | wid = mTodoEditor; | 2546 | wid = mTodoEditor; |
2552 | x = wid->geometry().x(); | 2547 | x = wid->geometry().x(); |
2553 | y = wid->geometry().y(); | 2548 | y = wid->geometry().y(); |
2554 | w = wid->width(); | 2549 | w = wid->width(); |
2555 | h = wid->height(); | 2550 | h = wid->height(); |
2556 | list.clear(); | 2551 | list.clear(); |
2557 | list << QString::number( x ); | 2552 | list << QString::number( x ); |
2558 | list << QString::number( y ); | 2553 | list << QString::number( y ); |
2559 | list << QString::number( w ); | 2554 | list << QString::number( w ); |
2560 | list << QString::number( h ); | 2555 | list << QString::number( h ); |
2561 | config->writeEntry("EditTodoLayout",list ); | 2556 | config->writeEntry("EditTodoLayout",list ); |
2562 | wid = getEventViewerDialog(); | 2557 | wid = getEventViewerDialog(); |
2563 | x = wid->geometry().x(); | 2558 | x = wid->geometry().x(); |
2564 | y = wid->geometry().y(); | 2559 | y = wid->geometry().y(); |
2565 | w = wid->width(); | 2560 | w = wid->width(); |
2566 | h = wid->height(); | 2561 | h = wid->height(); |
2567 | list.clear(); | 2562 | list.clear(); |
2568 | list << QString::number( x ); | 2563 | list << QString::number( x ); |
2569 | list << QString::number( y ); | 2564 | list << QString::number( y ); |
2570 | list << QString::number( w ); | 2565 | list << QString::number( w ); |
2571 | list << QString::number( h ); | 2566 | list << QString::number( h ); |
2572 | config->writeEntry("ViewerLayout",list ); | 2567 | config->writeEntry("ViewerLayout",list ); |
2573 | wid = mDialogManager->getSearchDialog(); | 2568 | wid = mDialogManager->getSearchDialog(); |
2574 | if ( wid ) { | 2569 | if ( wid ) { |
2575 | x = wid->geometry().x(); | 2570 | x = wid->geometry().x(); |
2576 | y = wid->geometry().y(); | 2571 | y = wid->geometry().y(); |
2577 | w = wid->width(); | 2572 | w = wid->width(); |
2578 | h = wid->height(); | 2573 | h = wid->height(); |
2579 | list.clear(); | 2574 | list.clear(); |
2580 | list << QString::number( x ); | 2575 | list << QString::number( x ); |
2581 | list << QString::number( y ); | 2576 | list << QString::number( y ); |
2582 | list << QString::number( w ); | 2577 | list << QString::number( w ); |
2583 | list << QString::number( h ); | 2578 | list << QString::number( h ); |
2584 | config->writeEntry("SearchLayout",list ); | 2579 | config->writeEntry("SearchLayout",list ); |
2585 | } | 2580 | } |
2586 | #endif | 2581 | #endif |
2587 | 2582 | ||
2588 | 2583 | ||
2589 | config->sync(); | 2584 | config->sync(); |
2590 | } | 2585 | } |
2591 | 2586 | ||
2592 | void CalendarView::readFilterSettings(KConfig *config) | 2587 | void CalendarView::readFilterSettings(KConfig *config) |
2593 | { | 2588 | { |
2594 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2589 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2595 | 2590 | ||
2596 | mFilters.clear(); | 2591 | mFilters.clear(); |
2597 | 2592 | ||
2598 | config->setGroup("General"); | 2593 | config->setGroup("General"); |
2599 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2594 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2600 | 2595 | ||
2601 | QStringList::ConstIterator it = filterList.begin(); | 2596 | QStringList::ConstIterator it = filterList.begin(); |
2602 | QStringList::ConstIterator end = filterList.end(); | 2597 | QStringList::ConstIterator end = filterList.end(); |
2603 | while(it != end) { | 2598 | while(it != end) { |
2604 | // kdDebug() << " filter: " << (*it) << endl; | 2599 | // kdDebug() << " filter: " << (*it) << endl; |
2605 | 2600 | ||
2606 | CalFilter *filter; | 2601 | CalFilter *filter; |
2607 | filter = new CalFilter(*it); | 2602 | filter = new CalFilter(*it); |
2608 | config->setGroup("Filter_" + (*it).utf8()); | 2603 | config->setGroup("Filter_" + (*it).utf8()); |
2609 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2604 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2610 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2605 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2611 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2606 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2612 | mFilters.append(filter); | 2607 | mFilters.append(filter); |
2613 | 2608 | ||
2614 | ++it; | 2609 | ++it; |
2615 | } | 2610 | } |
2616 | 2611 | ||
2617 | if (mFilters.count() == 0) { | 2612 | if (mFilters.count() == 0) { |
2618 | CalFilter *filter = new CalFilter(i18n("Default")); | 2613 | CalFilter *filter = new CalFilter(i18n("Default")); |
2619 | mFilters.append(filter); | 2614 | mFilters.append(filter); |
2620 | } | 2615 | } |
2621 | mFilterView->updateFilters(); | 2616 | mFilterView->updateFilters(); |
2622 | config->setGroup("FilterView"); | 2617 | config->setGroup("FilterView"); |
2623 | 2618 | ||
2624 | mFilterView->blockSignals(true); | 2619 | mFilterView->blockSignals(true); |
2625 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2620 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2626 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2621 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2627 | mFilterView->blockSignals(false); | 2622 | mFilterView->blockSignals(false); |
2628 | // We do it manually to avoid it being done twice by the above calls | 2623 | // We do it manually to avoid it being done twice by the above calls |
2629 | updateFilter(); | 2624 | updateFilter(); |
2630 | } | 2625 | } |
2631 | 2626 | ||
2632 | void CalendarView::writeFilterSettings(KConfig *config) | 2627 | void CalendarView::writeFilterSettings(KConfig *config) |
2633 | { | 2628 | { |
2634 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2629 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2635 | 2630 | ||
2636 | QStringList filterList; | 2631 | QStringList filterList; |
2637 | 2632 | ||
2638 | CalFilter *filter = mFilters.first(); | 2633 | CalFilter *filter = mFilters.first(); |
2639 | while(filter) { | 2634 | while(filter) { |
2640 | // kdDebug() << " fn: " << filter->name() << endl; | 2635 | // kdDebug() << " fn: " << filter->name() << endl; |
2641 | filterList << filter->name(); | 2636 | filterList << filter->name(); |
2642 | config->setGroup("Filter_" + filter->name().utf8()); | 2637 | config->setGroup("Filter_" + filter->name().utf8()); |
2643 | config->writeEntry("Criteria",filter->criteria()); | 2638 | config->writeEntry("Criteria",filter->criteria()); |
2644 | config->writeEntry("CategoryList",filter->categoryList()); | 2639 | config->writeEntry("CategoryList",filter->categoryList()); |
2645 | filter = mFilters.next(); | 2640 | filter = mFilters.next(); |
2646 | } | 2641 | } |
2647 | config->setGroup("General"); | 2642 | config->setGroup("General"); |
2648 | config->writeEntry("CalendarFilters",filterList); | 2643 | config->writeEntry("CalendarFilters",filterList); |
2649 | 2644 | ||
2650 | config->setGroup("FilterView"); | 2645 | config->setGroup("FilterView"); |
2651 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2646 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2652 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2647 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2653 | } | 2648 | } |
2654 | 2649 | ||
2655 | 2650 | ||
2656 | void CalendarView::goToday() | 2651 | void CalendarView::goToday() |
2657 | { | 2652 | { |
2658 | if ( mViewManager->currentView()->isMonthView() ) | 2653 | if ( mViewManager->currentView()->isMonthView() ) |
2659 | mNavigator->selectTodayMonth(); | 2654 | mNavigator->selectTodayMonth(); |
2660 | else | 2655 | else |
2661 | mNavigator->selectToday(); | 2656 | mNavigator->selectToday(); |
2662 | } | 2657 | } |
2663 | 2658 | ||
2664 | void CalendarView::goNext() | 2659 | void CalendarView::goNext() |
2665 | { | 2660 | { |
2666 | mNavigator->selectNext(); | 2661 | mNavigator->selectNext(); |
2667 | } | 2662 | } |
2668 | 2663 | ||
2669 | void CalendarView::goPrevious() | 2664 | void CalendarView::goPrevious() |
2670 | { | 2665 | { |
2671 | mNavigator->selectPrevious(); | 2666 | mNavigator->selectPrevious(); |
2672 | } | 2667 | } |
2673 | void CalendarView::goNextMonth() | 2668 | void CalendarView::goNextMonth() |
2674 | { | 2669 | { |
2675 | mNavigator->selectNextMonth(); | 2670 | mNavigator->selectNextMonth(); |
2676 | } | 2671 | } |
2677 | 2672 | ||
2678 | void CalendarView::goPreviousMonth() | 2673 | void CalendarView::goPreviousMonth() |
2679 | { | 2674 | { |
2680 | mNavigator->selectPreviousMonth(); | 2675 | mNavigator->selectPreviousMonth(); |
2681 | } | 2676 | } |
2682 | 2677 | ||
2683 | void CalendarView::updateConfig() | 2678 | void CalendarView::updateConfig() |
2684 | { | 2679 | { |
2685 | if ( KOPrefs::instance()->mUseAppColors ) | 2680 | if ( KOPrefs::instance()->mUseAppColors ) |
2686 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2681 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2687 | emit configChanged(); | 2682 | emit configChanged(); |
2688 | mTodoList->updateConfig(); | 2683 | mTodoList->updateConfig(); |
2689 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2684 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2690 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2685 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2691 | // To make the "fill window" configurations work | 2686 | // To make the "fill window" configurations work |
2692 | //mViewManager->raiseCurrentView(); | 2687 | //mViewManager->raiseCurrentView(); |
2693 | } | 2688 | } |
2694 | 2689 | ||
2695 | 2690 | ||
2696 | void CalendarView::eventChanged(Event *event) | 2691 | void CalendarView::eventChanged(Event *event) |
2697 | { | 2692 | { |
2698 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2693 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2699 | //updateUnmanagedViews(); | 2694 | //updateUnmanagedViews(); |
2700 | } | 2695 | } |
2701 | 2696 | ||
2702 | void CalendarView::eventAdded(Event *event) | 2697 | void CalendarView::eventAdded(Event *event) |
2703 | { | 2698 | { |
2704 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2699 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2705 | } | 2700 | } |
2706 | 2701 | ||
2707 | void CalendarView::eventToBeDeleted(Event *) | 2702 | void CalendarView::eventToBeDeleted(Event *) |
2708 | { | 2703 | { |
2709 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2704 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2710 | } | 2705 | } |
2711 | 2706 | ||
2712 | void CalendarView::eventDeleted() | 2707 | void CalendarView::eventDeleted() |
2713 | { | 2708 | { |
2714 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2709 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2715 | } | 2710 | } |
2716 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2711 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2717 | { | 2712 | { |
2718 | changeIncidenceDisplay((Incidence *)which, action); | 2713 | changeIncidenceDisplay((Incidence *)which, action); |
2719 | mDateNavigator->updateView(); //LR | 2714 | mDateNavigator->updateView(); //LR |
2720 | //mDialogManager->updateSearchDialog(); | 2715 | //mDialogManager->updateSearchDialog(); |
2721 | 2716 | ||
2722 | if (which) { | 2717 | if (which) { |
2723 | mViewManager->updateWNview(); | 2718 | mViewManager->updateWNview(); |
2724 | //mTodoList->updateView(); | 2719 | //mTodoList->updateView(); |
2725 | } | 2720 | } |
2726 | 2721 | ||
2727 | } | 2722 | } |
2728 | 2723 | ||
2729 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2724 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2730 | { | 2725 | { |
2731 | updateUnmanagedViews(); | 2726 | updateUnmanagedViews(); |
2732 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2727 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2733 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2728 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2734 | mCalendar->checkAlarmForIncidence( 0, true ); | 2729 | mCalendar->checkAlarmForIncidence( 0, true ); |
2735 | if ( mEventViewerDialog ) | 2730 | if ( mEventViewerDialog ) |
2736 | mEventViewerDialog->hide(); | 2731 | mEventViewerDialog->hide(); |
2737 | } | 2732 | } |
2738 | else | 2733 | else |
2739 | mCalendar->checkAlarmForIncidence( which , false ); | 2734 | mCalendar->checkAlarmForIncidence( which , false ); |
2740 | } | 2735 | } |
2741 | 2736 | ||
2742 | // most of the changeEventDisplays() right now just call the view's | 2737 | // most of the changeEventDisplays() right now just call the view's |
2743 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2738 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2744 | void CalendarView::changeEventDisplay(Event *which, int action) | 2739 | void CalendarView::changeEventDisplay(Event *which, int action) |
2745 | { | 2740 | { |
2746 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2741 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2747 | changeIncidenceDisplay((Incidence *)which, action); | 2742 | changeIncidenceDisplay((Incidence *)which, action); |
2748 | static bool clearallviews = false; | 2743 | static bool clearallviews = false; |
2749 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2744 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2750 | if ( clearallviews ) { | 2745 | if ( clearallviews ) { |
2751 | clearAllViews(); | 2746 | clearAllViews(); |
2752 | clearallviews = false; | 2747 | clearallviews = false; |
2753 | } | 2748 | } |
2754 | return; | 2749 | return; |
2755 | } | 2750 | } |
2756 | clearallviews = true; | 2751 | clearallviews = true; |
2757 | mDateNavigator->updateView(); | 2752 | mDateNavigator->updateView(); |
2758 | //mDialogManager->updateSearchDialog(); | 2753 | //mDialogManager->updateSearchDialog(); |
2759 | if (which) { | 2754 | if (which) { |
2760 | // If there is an event view visible update the display | 2755 | // If there is an event view visible update the display |
2761 | mViewManager->currentView()->changeEventDisplay(which,action); | 2756 | mViewManager->currentView()->changeEventDisplay(which,action); |
2762 | // TODO: check, if update needed | 2757 | // TODO: check, if update needed |
2763 | // if (which->getTodoStatus()) { | 2758 | // if (which->getTodoStatus()) { |
2764 | mTodoList->updateView(); | 2759 | mTodoList->updateView(); |
2765 | if ( action != KOGlobals::EVENTDELETED ) { | 2760 | if ( action != KOGlobals::EVENTDELETED ) { |
2766 | mConflictingEvent = which ; | 2761 | mConflictingEvent = which ; |
2767 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); | 2762 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); |
2768 | } | 2763 | } |
2769 | // } | 2764 | // } |
2770 | } else { | 2765 | } else { |
2771 | mViewManager->currentView()->updateView(); | 2766 | mViewManager->currentView()->updateView(); |
2772 | } | 2767 | } |
2773 | } | 2768 | } |
2774 | void CalendarView::checkConflictForEvent() | 2769 | void CalendarView::checkConflictForEvent() |
2775 | { | 2770 | { |
2776 | 2771 | ||
2777 | if (!KOPrefs::instance()->mConfirm) | 2772 | if (!KOPrefs::instance()->mConfirm) |
2778 | return; | 2773 | return; |
2779 | if ( ! mConflictingEvent ) return; | 2774 | if ( ! mConflictingEvent ) return; |
2780 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 2775 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
2781 | QPtrList<Event> testlist = mCalendar->events(); | 2776 | QPtrList<Event> testlist = mCalendar->events(); |
2782 | Event * test = testlist.first(); | 2777 | Event * test = testlist.first(); |
2783 | QDateTime conflict; | 2778 | QDateTime conflict; |
2784 | QDateTime retVal; | 2779 | QDateTime retVal; |
2785 | bool found = false; | 2780 | bool found = false; |
2786 | Event * cE = 0; | 2781 | Event * cE = 0; |
2787 | QDateTime current = QDateTime::currentDateTime(); | 2782 | QDateTime current = QDateTime::currentDateTime(); |
2788 | while ( test ) { | 2783 | while ( test ) { |
2789 | qApp->processEvents(); | 2784 | qApp->processEvents(); |
2790 | if ( !test->doesFloat() ) { | 2785 | if ( !test->doesFloat() ) { |
2791 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 2786 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
2792 | if ( ! found ) { | 2787 | if ( ! found ) { |
2793 | conflict = retVal; | 2788 | conflict = retVal; |
2794 | cE = test; | 2789 | cE = test; |
2795 | } else { | 2790 | } else { |
2796 | if ( retVal < conflict ) { | 2791 | if ( retVal < conflict ) { |
2797 | conflict = retVal; | 2792 | conflict = retVal; |
2798 | cE = test; | 2793 | cE = test; |
2799 | } | 2794 | } |
2800 | } | 2795 | } |
2801 | found = true; | 2796 | found = true; |
2802 | } | 2797 | } |
2803 | } | 2798 | } |
2804 | test = testlist.next(); | 2799 | test = testlist.next(); |
2805 | } | 2800 | } |
2806 | if ( found ) { | 2801 | if ( found ) { |
2807 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 2802 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
2808 | qApp->processEvents(); | 2803 | qApp->processEvents(); |
2809 | int km = KMessageBox::warningContinueCancel(this,mess, | 2804 | int km = KMessageBox::warningContinueCancel(this,mess, |
2810 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 2805 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); |
2811 | if ( km != KMessageBox::Continue ) | 2806 | if ( km != KMessageBox::Continue ) |
2812 | return; | 2807 | return; |
2813 | 2808 | ||
2814 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 2809 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
2815 | mViewManager->showDayView(); | 2810 | mViewManager->showDayView(); |
2816 | mNavigator->slotDaySelect( conflict.date() ); | 2811 | mNavigator->slotDaySelect( conflict.date() ); |
2817 | int hour = conflict.time().hour(); | 2812 | int hour = conflict.time().hour(); |
2818 | mViewManager->agendaView()->setStartHour( hour ); | 2813 | mViewManager->agendaView()->setStartHour( hour ); |
2819 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 2814 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
2820 | } else | 2815 | } else |
2821 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 2816 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
2822 | mConflictingEvent = 0; | 2817 | mConflictingEvent = 0; |
2823 | return; | 2818 | return; |
2824 | 2819 | ||
2825 | } | 2820 | } |
2826 | 2821 | ||
2827 | void CalendarView::updateTodoViews() | 2822 | void CalendarView::updateTodoViews() |
2828 | { | 2823 | { |
2829 | mTodoList->updateView(); | 2824 | mTodoList->updateView(); |
2830 | mViewManager->currentView()->updateView(); | 2825 | mViewManager->currentView()->updateView(); |
2831 | 2826 | ||
2832 | } | 2827 | } |
2833 | 2828 | ||
2834 | 2829 | ||
2835 | 2830 | ||
2836 | void CalendarView::clearAllViews() | 2831 | void CalendarView::clearAllViews() |
2837 | { | 2832 | { |
2838 | mTodoList->clearList(); | 2833 | mTodoList->clearList(); |
2839 | mViewManager->clearAllViews(); | 2834 | mViewManager->clearAllViews(); |
2840 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2835 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2841 | if ( sd ) { | 2836 | if ( sd ) { |
2842 | KOListView* kol = sd->listview(); | 2837 | KOListView* kol = sd->listview(); |
2843 | if ( kol ) | 2838 | if ( kol ) |
2844 | kol->clearList(); | 2839 | kol->clearList(); |
2845 | } | 2840 | } |
2846 | } | 2841 | } |
2847 | void CalendarView::updateView() | 2842 | void CalendarView::updateView() |
2848 | { | 2843 | { |
2849 | static bool clearallviews = false; | 2844 | static bool clearallviews = false; |
2850 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2845 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2851 | if ( clearallviews ) { | 2846 | if ( clearallviews ) { |
2852 | clearAllViews(); | 2847 | clearAllViews(); |
2853 | clearallviews = false; | 2848 | clearallviews = false; |
2854 | } | 2849 | } |
2855 | return; | 2850 | return; |
2856 | } | 2851 | } |
2857 | clearallviews = true; | 2852 | clearallviews = true; |
2858 | DateList tmpList = mNavigator->selectedDates(); | 2853 | DateList tmpList = mNavigator->selectedDates(); |
2859 | 2854 | ||
2860 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2855 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2861 | mTodoList->updateView(); | 2856 | mTodoList->updateView(); |
2862 | // We assume that the navigator only selects consecutive days. | 2857 | // We assume that the navigator only selects consecutive days. |
2863 | updateView( tmpList.first(), tmpList.last() ); | 2858 | updateView( tmpList.first(), tmpList.last() ); |
2864 | } | 2859 | } |
2865 | 2860 | ||
2866 | void CalendarView::updateUnmanagedViews() | 2861 | void CalendarView::updateUnmanagedViews() |
2867 | { | 2862 | { |
2868 | mDateNavigator->updateDayMatrix(); | 2863 | mDateNavigator->updateDayMatrix(); |
2869 | } | 2864 | } |
2870 | 2865 | ||
2871 | int CalendarView::msgItemDelete(const QString name) | 2866 | int CalendarView::msgItemDelete(const QString name) |
2872 | { | 2867 | { |
2873 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2868 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2874 | i18n("This item will be\npermanently deleted."), | 2869 | i18n("This item will be\npermanently deleted."), |
2875 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2870 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2876 | } | 2871 | } |
2877 | 2872 | ||
2878 | 2873 | ||
2879 | void CalendarView::edit_cut() | 2874 | void CalendarView::edit_cut() |
2880 | { | 2875 | { |
2881 | Event *anEvent=0; | 2876 | Event *anEvent=0; |
2882 | 2877 | ||
2883 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2878 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2884 | 2879 | ||
2885 | if (mViewManager->currentView()->isEventView()) { | 2880 | if (mViewManager->currentView()->isEventView()) { |
2886 | if ( incidence && incidence->typeID() == eventID ) { | 2881 | if ( incidence && incidence->typeID() == eventID ) { |
2887 | anEvent = static_cast<Event *>(incidence); | 2882 | anEvent = static_cast<Event *>(incidence); |
2888 | } | 2883 | } |
2889 | } | 2884 | } |
2890 | 2885 | ||
2891 | if (!anEvent) { | 2886 | if (!anEvent) { |
2892 | KNotifyClient::beep(); | 2887 | KNotifyClient::beep(); |
2893 | return; | 2888 | return; |
2894 | } | 2889 | } |
2895 | DndFactory factory( mCalendar ); | 2890 | DndFactory factory( mCalendar ); |
2896 | factory.cutIncidence(anEvent); | 2891 | factory.cutIncidence(anEvent); |
2897 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2892 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2898 | } | 2893 | } |
2899 | 2894 | ||
2900 | void CalendarView::edit_copy() | 2895 | void CalendarView::edit_copy() |
2901 | { | 2896 | { |
2902 | Event *anEvent=0; | 2897 | Event *anEvent=0; |
2903 | 2898 | ||
2904 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2899 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2905 | 2900 | ||
2906 | if (mViewManager->currentView()->isEventView()) { | 2901 | if (mViewManager->currentView()->isEventView()) { |
2907 | if ( incidence && incidence->typeID() == eventID ) { | 2902 | if ( incidence && incidence->typeID() == eventID ) { |
2908 | anEvent = static_cast<Event *>(incidence); | 2903 | anEvent = static_cast<Event *>(incidence); |
2909 | } | 2904 | } |
2910 | } | 2905 | } |
2911 | 2906 | ||
2912 | if (!anEvent) { | 2907 | if (!anEvent) { |
2913 | KNotifyClient::beep(); | 2908 | KNotifyClient::beep(); |
2914 | return; | 2909 | return; |
2915 | } | 2910 | } |
2916 | DndFactory factory( mCalendar ); | 2911 | DndFactory factory( mCalendar ); |
2917 | factory.copyIncidence(anEvent); | 2912 | factory.copyIncidence(anEvent); |
2918 | } | 2913 | } |
2919 | 2914 | ||
2920 | void CalendarView::edit_paste() | 2915 | void CalendarView::edit_paste() |
2921 | { | 2916 | { |
2922 | QDate date = mNavigator->selectedDates().first(); | 2917 | QDate date = mNavigator->selectedDates().first(); |
2923 | 2918 | ||
2924 | DndFactory factory( mCalendar ); | 2919 | DndFactory factory( mCalendar ); |
2925 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2920 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2926 | 2921 | ||
2927 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2922 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2928 | } | 2923 | } |
2929 | void CalendarView::edit_global_options() | 2924 | void CalendarView::edit_global_options() |
2930 | { | 2925 | { |
2931 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2926 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2932 | emit save(); | 2927 | emit save(); |
2933 | emit saveStopTimer(); | 2928 | emit saveStopTimer(); |
2934 | mDialogManager->showGlobalOptionsDialog(); | 2929 | mDialogManager->showGlobalOptionsDialog(); |
2935 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2930 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2936 | emit saveStopTimer(); | 2931 | emit saveStopTimer(); |
2937 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2932 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2938 | i18n("Timezone settings"),i18n("Reload"))) { | 2933 | i18n("Timezone settings"),i18n("Reload"))) { |
2939 | qDebug("KO: TZ reload cancelled "); | 2934 | qDebug("KO: TZ reload cancelled "); |
2940 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2935 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2941 | return; | 2936 | return; |
2942 | } | 2937 | } |
2943 | qDebug("KO: Timezone change "); | 2938 | qDebug("KO: Timezone change "); |
2944 | loadCalendars(); | 2939 | loadCalendars(); |
2945 | setModified(true); | 2940 | setModified(true); |
2946 | } | 2941 | } |
2947 | else | 2942 | else |
2948 | qDebug("KO: No tz change "); | 2943 | qDebug("KO: No tz change "); |
2949 | } | 2944 | } |
2950 | void CalendarView::edit_options() | 2945 | void CalendarView::edit_options() |
2951 | { | 2946 | { |
2952 | mDialogManager->showOptionsDialog(); | 2947 | mDialogManager->showOptionsDialog(); |
2953 | } | 2948 | } |
2954 | 2949 | ||
2955 | 2950 | ||
2956 | void CalendarView::slotSelectPickerDate( QDate d) | 2951 | void CalendarView::slotSelectPickerDate( QDate d) |
2957 | { | 2952 | { |
2958 | mDateFrame->hide(); | 2953 | mDateFrame->hide(); |
2959 | if ( mDatePickerMode == 1 ) { | 2954 | if ( mDatePickerMode == 1 ) { |
2960 | mNavigator->slotDaySelect( d ); | 2955 | mNavigator->slotDaySelect( d ); |
2961 | } else if ( mDatePickerMode == 2 ) { | 2956 | } else if ( mDatePickerMode == 2 ) { |
2962 | if ( mMoveIncidence->typeID() == todoID ) { | 2957 | if ( mMoveIncidence->typeID() == todoID ) { |
2963 | Todo * to = (Todo *) mMoveIncidence; | 2958 | Todo * to = (Todo *) mMoveIncidence; |
2964 | QTime tim; | 2959 | QTime tim; |
2965 | int len = 0; | 2960 | int len = 0; |
2966 | if ( to->hasStartDate() && to->hasDueDate() ) | 2961 | if ( to->hasStartDate() && to->hasDueDate() ) |
2967 | len = to->dtStart().secsTo( to->dtDue()); | 2962 | len = to->dtStart().secsTo( to->dtDue()); |
2968 | if ( to->hasDueDate() ) | 2963 | if ( to->hasDueDate() ) |
2969 | tim = to->dtDue().time(); | 2964 | tim = to->dtDue().time(); |
2970 | else { | 2965 | else { |
2971 | tim = QTime ( 0,0,0 ); | 2966 | tim = QTime ( 0,0,0 ); |
2972 | to->setFloats( true ); | 2967 | to->setFloats( true ); |
2973 | to->setHasDueDate( true ); | 2968 | to->setHasDueDate( true ); |
2974 | } | 2969 | } |
2975 | QDateTime dt ( d,tim ); | 2970 | QDateTime dt ( d,tim ); |
2976 | to->setDtDue( dt ); | 2971 | to->setDtDue( dt ); |
2977 | 2972 | ||
2978 | if ( to->hasStartDate() ) { | 2973 | if ( to->hasStartDate() ) { |
2979 | if ( len>0 ) | 2974 | if ( len>0 ) |
2980 | to->setDtStart(to->dtDue().addSecs( -len )); | 2975 | to->setDtStart(to->dtDue().addSecs( -len )); |
2981 | else | 2976 | else |
2982 | if (to->dtStart() > to->dtDue() ) | 2977 | if (to->dtStart() > to->dtDue() ) |
2983 | to->setDtStart(to->dtDue().addDays( -3 )); | 2978 | to->setDtStart(to->dtDue().addDays( -3 )); |
2984 | } | 2979 | } |
2985 | 2980 | ||
2986 | todoChanged( to ); | 2981 | todoChanged( to ); |
2987 | } else if ( mMoveIncidence->typeID() == eventID ) { | 2982 | } else if ( mMoveIncidence->typeID() == eventID ) { |
2988 | if ( mMoveIncidence->doesRecur() ) { | 2983 | if ( mMoveIncidence->doesRecur() ) { |
2989 | #if 0 | 2984 | #if 0 |
2990 | // PENDING implement this | 2985 | // PENDING implement this |
2991 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2986 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2992 | mCalendar()->addIncidence( newInc ); | 2987 | mCalendar()->addIncidence( newInc ); |
2993 | if ( mMoveIncidence->typeID() == todoID ) | 2988 | if ( mMoveIncidence->typeID() == todoID ) |
2994 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2989 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2995 | else | 2990 | else |
2996 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2991 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2997 | mMoveIncidence = newInc; | 2992 | mMoveIncidence = newInc; |
2998 | 2993 | ||
2999 | #endif | 2994 | #endif |
3000 | } | 2995 | } |
3001 | QTime tim = mMoveIncidence->dtStart().time(); | 2996 | QTime tim = mMoveIncidence->dtStart().time(); |
3002 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2997 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
3003 | QDateTime dt ( d,tim ); | 2998 | QDateTime dt ( d,tim ); |
3004 | mMoveIncidence->setDtStart( dt ); | 2999 | mMoveIncidence->setDtStart( dt ); |
3005 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 3000 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
3006 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 3001 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
3007 | } else if ( mMoveIncidence->typeID() == journalID ) { | 3002 | } else if ( mMoveIncidence->typeID() == journalID ) { |
3008 | QTime tim = mMoveIncidence->dtStart().time(); | 3003 | QTime tim = mMoveIncidence->dtStart().time(); |
3009 | QDateTime dt ( d,tim ); | 3004 | QDateTime dt ( d,tim ); |
3010 | mMoveIncidence->setDtStart( dt ); | 3005 | mMoveIncidence->setDtStart( dt ); |
3011 | updateView(); | 3006 | updateView(); |
3012 | } | 3007 | } |
3013 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 3008 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
3014 | } | 3009 | } |
3015 | } | 3010 | } |
3016 | 3011 | ||
3017 | void CalendarView::removeCategories() | 3012 | void CalendarView::removeCategories() |
3018 | { | 3013 | { |
3019 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3014 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3020 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3015 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3021 | QStringList catIncList; | 3016 | QStringList catIncList; |
3022 | QStringList newCatList; | 3017 | QStringList newCatList; |
3023 | Incidence* inc = incList.first(); | 3018 | Incidence* inc = incList.first(); |
3024 | uint i; | 3019 | uint i; |
3025 | while ( inc ) { | 3020 | while ( inc ) { |
3026 | newCatList.clear(); | 3021 | newCatList.clear(); |
3027 | catIncList = inc->categories() ; | 3022 | catIncList = inc->categories() ; |
3028 | for( i = 0; i< catIncList.count(); ++i ) { | 3023 | for( i = 0; i< catIncList.count(); ++i ) { |
3029 | if ( catList.contains (catIncList[i])) | 3024 | if ( catList.contains (catIncList[i])) |
3030 | newCatList.append( catIncList[i] ); | 3025 | newCatList.append( catIncList[i] ); |
3031 | } | 3026 | } |
3032 | newCatList.sort(); | 3027 | newCatList.sort(); |
3033 | inc->setCategories( newCatList.join(",") ); | 3028 | inc->setCategories( newCatList.join(",") ); |
3034 | inc = incList.next(); | 3029 | inc = incList.next(); |
3035 | } | 3030 | } |
3036 | } | 3031 | } |
3037 | 3032 | ||
3038 | int CalendarView::addCategories() | 3033 | int CalendarView::addCategories() |
3039 | { | 3034 | { |
3040 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3035 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3041 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3036 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3042 | QStringList catIncList; | 3037 | QStringList catIncList; |
3043 | Incidence* inc = incList.first(); | 3038 | Incidence* inc = incList.first(); |
3044 | uint i; | 3039 | uint i; |
3045 | int count = 0; | 3040 | int count = 0; |
3046 | while ( inc ) { | 3041 | while ( inc ) { |
3047 | catIncList = inc->categories() ; | 3042 | catIncList = inc->categories() ; |
3048 | for( i = 0; i< catIncList.count(); ++i ) { | 3043 | for( i = 0; i< catIncList.count(); ++i ) { |
3049 | if ( !catList.contains (catIncList[i])) { | 3044 | if ( !catList.contains (catIncList[i])) { |
3050 | catList.append( catIncList[i] ); | 3045 | catList.append( catIncList[i] ); |
3051 | //qDebug("add cat %s ", catIncList[i].latin1()); | 3046 | //qDebug("add cat %s ", catIncList[i].latin1()); |
3052 | ++count; | 3047 | ++count; |
3053 | } | 3048 | } |
3054 | } | 3049 | } |
3055 | inc = incList.next(); | 3050 | inc = incList.next(); |
3056 | } | 3051 | } |
3057 | catList.sort(); | 3052 | catList.sort(); |
3058 | KOPrefs::instance()->mCustomCategories = catList; | 3053 | KOPrefs::instance()->mCustomCategories = catList; |
3059 | return count; | 3054 | return count; |
3060 | } | 3055 | } |
3061 | 3056 | ||
3062 | void CalendarView::editCategories() | 3057 | void CalendarView::editCategories() |
3063 | { | 3058 | { |
3064 | qDebug("CalendarView::editCategories() "); | 3059 | qDebug("CalendarView::editCategories() "); |
3065 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); | 3060 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); |
3066 | ced.exec(); | 3061 | ced.exec(); |
3067 | } | 3062 | } |
3068 | void CalendarView::manageCategories() | 3063 | void CalendarView::manageCategories() |
3069 | { | 3064 | { |
3070 | KOCatPrefs* cp = new KOCatPrefs(); | 3065 | KOCatPrefs* cp = new KOCatPrefs(); |
3071 | cp->show(); | 3066 | cp->show(); |
3072 | int w =cp->sizeHint().width() ; | 3067 | int w =cp->sizeHint().width() ; |
3073 | int h = cp->sizeHint().height() ; | 3068 | int h = cp->sizeHint().height() ; |
3074 | int dw = QApplication::desktop()->width(); | 3069 | int dw = QApplication::desktop()->width(); |
3075 | int dh = QApplication::desktop()->height(); | 3070 | int dh = QApplication::desktop()->height(); |
3076 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 3071 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
3077 | if ( !cp->exec() ) { | 3072 | if ( !cp->exec() ) { |
3078 | delete cp; | 3073 | delete cp; |
3079 | return; | 3074 | return; |
3080 | } | 3075 | } |
3081 | int count = 0; | 3076 | int count = 0; |
3082 | if ( cp->addCat() ) { | 3077 | if ( cp->addCat() ) { |
3083 | count = addCategories(); | 3078 | count = addCategories(); |
3084 | if ( count ) { | 3079 | if ( count ) { |
3085 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 3080 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
3086 | writeSettings(); | 3081 | writeSettings(); |
3087 | } else | 3082 | } else |
3088 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 3083 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
3089 | } else { | 3084 | } else { |
3090 | removeCategories(); | 3085 | removeCategories(); |
3091 | updateView(); | 3086 | updateView(); |
3092 | } | 3087 | } |
3093 | delete cp; | 3088 | delete cp; |
3094 | } | 3089 | } |
3095 | 3090 | ||
3096 | void CalendarView::beamIncidence(Incidence * Inc) | 3091 | void CalendarView::beamIncidence(Incidence * Inc) |
3097 | { | 3092 | { |
3098 | QPtrList<Incidence> delSel ; | 3093 | QPtrList<Incidence> delSel ; |
3099 | delSel.append(Inc); | 3094 | delSel.append(Inc); |
3100 | beamIncidenceList( delSel ); | 3095 | beamIncidenceList( delSel ); |
3101 | } | 3096 | } |
3102 | void CalendarView::beamCalendar() | 3097 | void CalendarView::beamCalendar() |
3103 | { | 3098 | { |
3104 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 3099 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
3105 | //qDebug("beamCalendar() "); | 3100 | //qDebug("beamCalendar() "); |
3106 | beamIncidenceList( delSel ); | 3101 | beamIncidenceList( delSel ); |
3107 | } | 3102 | } |
3108 | void CalendarView::beamFilteredCalendar() | 3103 | void CalendarView::beamFilteredCalendar() |
3109 | { | 3104 | { |
3110 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 3105 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
3111 | //qDebug("beamFilteredCalendar() "); | 3106 | //qDebug("beamFilteredCalendar() "); |
3112 | beamIncidenceList( delSel ); | 3107 | beamIncidenceList( delSel ); |
3113 | } | 3108 | } |
3114 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 3109 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
3115 | { | 3110 | { |
3116 | 3111 | ||
3117 | KOBeamPrefs beamDialog; | 3112 | KOBeamPrefs beamDialog; |
3118 | if ( beamDialog.exec () == QDialog::Rejected ) | 3113 | if ( beamDialog.exec () == QDialog::Rejected ) |
3119 | return; | 3114 | return; |
3120 | #ifdef DESKTOP_VERSION | 3115 | #ifdef DESKTOP_VERSION |
3121 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 3116 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
3122 | #else | 3117 | #else |
3123 | QString fn = "/tmp/kopibeamfile"; | 3118 | QString fn = "/tmp/kopibeamfile"; |
3124 | #endif | 3119 | #endif |
3125 | QString mes; | 3120 | QString mes; |
3126 | bool createbup = true; | 3121 | bool createbup = true; |
3127 | if ( createbup ) { | 3122 | if ( createbup ) { |
3128 | QString description = "\n"; | 3123 | QString description = "\n"; |
3129 | CalendarLocal* cal = new CalendarLocal(); | 3124 | CalendarLocal* cal = new CalendarLocal(); |
3130 | if ( beamDialog.beamLocal() ) | 3125 | if ( beamDialog.beamLocal() ) |
3131 | cal->setLocalTime(); | 3126 | cal->setLocalTime(); |
3132 | else | 3127 | else |
3133 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 3128 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
3134 | Incidence *incidence = delSel.first(); | 3129 | Incidence *incidence = delSel.first(); |
3135 | bool addText = false; | 3130 | bool addText = false; |
3136 | if ( delSel.count() < 10 ) | 3131 | if ( delSel.count() < 10 ) |
3137 | addText = true; | 3132 | addText = true; |
3138 | else { | 3133 | else { |
3139 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 3134 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
3140 | } | 3135 | } |
3141 | while ( incidence ) { | 3136 | while ( incidence ) { |
3142 | Incidence *in = incidence->clone(); | 3137 | Incidence *in = incidence->clone(); |
3143 | if ( ! in->summary().isEmpty() ) { | 3138 | if ( ! in->summary().isEmpty() ) { |
3144 | in->setDescription(""); | 3139 | in->setDescription(""); |
3145 | } else { | 3140 | } else { |
3146 | in->setSummary( in->description().left(20)); | 3141 | in->setSummary( in->description().left(20)); |
3147 | in->setDescription(""); | 3142 | in->setDescription(""); |
3148 | } | 3143 | } |
3149 | if ( addText ) | 3144 | if ( addText ) |
3150 | description += in->summary() + "\n"; | 3145 | description += in->summary() + "\n"; |
3151 | cal->addIncidence( in ); | 3146 | cal->addIncidence( in ); |
3152 | incidence = delSel.next(); | 3147 | incidence = delSel.next(); |
3153 | } | 3148 | } |
3154 | if ( beamDialog.beamVcal() ) { | 3149 | if ( beamDialog.beamVcal() ) { |
3155 | fn += ".vcs"; | 3150 | fn += ".vcs"; |
3156 | FileStorage storage( cal, fn, new VCalFormat ); | 3151 | FileStorage storage( cal, fn, new VCalFormat ); |
3157 | storage.save(); | 3152 | storage.save(); |
3158 | } else { | 3153 | } else { |
3159 | fn += ".ics"; | 3154 | fn += ".ics"; |
3160 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 3155 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
3161 | storage.save(); | 3156 | storage.save(); |
3162 | } | 3157 | } |
3163 | delete cal; | 3158 | delete cal; |
3164 | mes = i18n("KO/Pi: Ready for beaming"); | 3159 | mes = i18n("KO/Pi: Ready for beaming"); |
3165 | topLevelWidget()->setCaption(mes); | 3160 | topLevelWidget()->setCaption(mes); |
3166 | KApplication::convert2latin1( fn ); | 3161 | KApplication::convert2latin1( fn ); |
3167 | #ifndef DESKTOP_VERSION | 3162 | #ifndef DESKTOP_VERSION |
3168 | Ir *ir = new Ir( this ); | 3163 | Ir *ir = new Ir( this ); |
3169 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 3164 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
3170 | ir->send( fn, description, "text/x-vCalendar" ); | 3165 | ir->send( fn, description, "text/x-vCalendar" ); |
3171 | #endif | 3166 | #endif |
3172 | } | 3167 | } |
3173 | } | 3168 | } |
3174 | 3169 | ||
3175 | #ifndef DESKTOP_VERSION | 3170 | #ifndef DESKTOP_VERSION |
3176 | void CalendarView::beamDone( Ir *ir ) | 3171 | void CalendarView::beamDone( Ir *ir ) |
3177 | { | 3172 | { |
3178 | delete ir; | 3173 | delete ir; |
3179 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 3174 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
3180 | topLevelWidget()->raise(); | 3175 | topLevelWidget()->raise(); |
3181 | } | 3176 | } |
3182 | #else | 3177 | #else |
3183 | void CalendarView::beamDone( Ir *){;} | 3178 | void CalendarView::beamDone( Ir *){;} |
3184 | #endif | 3179 | #endif |
3185 | void CalendarView::moveIncidence(Incidence * inc ) | 3180 | void CalendarView::moveIncidence(Incidence * inc ) |
3186 | { | 3181 | { |
3187 | if ( !inc ) return; | 3182 | if ( !inc ) return; |
3188 | showDatePickerPopup(); | 3183 | showDatePickerPopup(); |
3189 | mDatePickerMode = 2; | 3184 | mDatePickerMode = 2; |
3190 | mMoveIncidence = inc ; | 3185 | mMoveIncidence = inc ; |
3191 | QDate da; | 3186 | QDate da; |
3192 | if ( mMoveIncidence->typeID() == todoID ) { | 3187 | if ( mMoveIncidence->typeID() == todoID ) { |
3193 | Todo * to = (Todo *) mMoveIncidence; | 3188 | Todo * to = (Todo *) mMoveIncidence; |
3194 | if ( to->hasDueDate() ) | 3189 | if ( to->hasDueDate() ) |
3195 | da = to->dtDue().date(); | 3190 | da = to->dtDue().date(); |
3196 | else | 3191 | else |
3197 | da = QDate::currentDate(); | 3192 | da = QDate::currentDate(); |
3198 | } else { | 3193 | } else { |
3199 | da = mMoveIncidence->dtStart().date(); | 3194 | da = mMoveIncidence->dtStart().date(); |
3200 | } | 3195 | } |
3201 | //PENDING set date for recurring incidence to date of recurrence | 3196 | //PENDING set date for recurring incidence to date of recurrence |
3202 | //mMoveIncidenceOldDate; | 3197 | //mMoveIncidenceOldDate; |
3203 | mDatePicker->setDate( da ); | 3198 | mDatePicker->setDate( da ); |
3204 | } | 3199 | } |
3205 | void CalendarView::showDatePickerPopup() | 3200 | void CalendarView::showDatePickerPopup() |
3206 | { | 3201 | { |
3207 | if ( mDateFrame->isVisible() ) | 3202 | if ( mDateFrame->isVisible() ) |
3208 | mDateFrame->hide(); | 3203 | mDateFrame->hide(); |
3209 | else { | 3204 | else { |
3210 | int offX = 0, offY = 0; | 3205 | int offX = 0, offY = 0; |
3211 | #ifdef DESKTOP_VERSION | 3206 | #ifdef DESKTOP_VERSION |
3212 | int w =mDatePicker->sizeHint().width() ; | 3207 | int w =mDatePicker->sizeHint().width() ; |
3213 | int h = mDatePicker->sizeHint().height() ; | 3208 | int h = mDatePicker->sizeHint().height() ; |
3214 | int dw = topLevelWidget()->width(); | 3209 | int dw = topLevelWidget()->width(); |
3215 | int dh = topLevelWidget()->height(); | 3210 | int dh = topLevelWidget()->height(); |
3216 | offX = topLevelWidget()->x(); | 3211 | offX = topLevelWidget()->x(); |
3217 | offY = topLevelWidget()->y(); | 3212 | offY = topLevelWidget()->y(); |
3218 | #else | 3213 | #else |
3219 | int w =mDatePicker->sizeHint().width() ; | 3214 | int w =mDatePicker->sizeHint().width() ; |
3220 | int h = mDatePicker->sizeHint().height() ; | 3215 | int h = mDatePicker->sizeHint().height() ; |
3221 | int dw = QApplication::desktop()->width(); | 3216 | int dw = QApplication::desktop()->width(); |
3222 | int dh = QApplication::desktop()->height(); | 3217 | int dh = QApplication::desktop()->height(); |
3223 | #endif | 3218 | #endif |
3224 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | 3219 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); |
3225 | mDateFrame->show(); | 3220 | mDateFrame->show(); |
3226 | } | 3221 | } |
3227 | } | 3222 | } |
3228 | void CalendarView::showDatePicker( ) | 3223 | void CalendarView::showDatePicker( ) |
3229 | { | 3224 | { |
3230 | showDatePickerPopup(); | 3225 | showDatePickerPopup(); |
3231 | mDatePickerMode = 1; | 3226 | mDatePickerMode = 1; |
3232 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 3227 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
3233 | } | 3228 | } |
3234 | 3229 | ||
3235 | void CalendarView::showEventEditor() | 3230 | void CalendarView::showEventEditor() |
3236 | { | 3231 | { |
3237 | #ifdef DESKTOP_VERSION | 3232 | #ifdef DESKTOP_VERSION |
3238 | int x,y,w,h; | 3233 | int x,y,w,h; |
3239 | x = mEventEditor->geometry().x(); | 3234 | x = mEventEditor->geometry().x(); |
3240 | y = mEventEditor->geometry().y(); | 3235 | y = mEventEditor->geometry().y(); |
3241 | w = mEventEditor->width(); | 3236 | w = mEventEditor->width(); |
3242 | h = mEventEditor->height(); | 3237 | h = mEventEditor->height(); |
3243 | mEventEditor->show(); | 3238 | mEventEditor->show(); |
3244 | mEventEditor->setGeometry(x,y,w,h); | 3239 | mEventEditor->setGeometry(x,y,w,h); |
3245 | #else | 3240 | #else |
3246 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 3241 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
3247 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 3242 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
3248 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 3243 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
3249 | qApp->processEvents(); | 3244 | qApp->processEvents(); |
3250 | delete mEventEditor; | 3245 | delete mEventEditor; |
3251 | mEventEditor = mDialogManager->getEventEditor(); | 3246 | mEventEditor = mDialogManager->getEventEditor(); |
3252 | topLevelWidget()->setCaption( i18n("") ); | 3247 | topLevelWidget()->setCaption( i18n("") ); |
3253 | } | 3248 | } |
3254 | mEventEditor->showMaximized(); | 3249 | mEventEditor->showMaximized(); |
3255 | #endif | 3250 | #endif |
3256 | } | 3251 | } |
3257 | void CalendarView::showTodoEditor() | 3252 | void CalendarView::showTodoEditor() |
3258 | { | 3253 | { |
3259 | #ifdef DESKTOP_VERSION | 3254 | #ifdef DESKTOP_VERSION |
3260 | int x,y,w,h; | 3255 | int x,y,w,h; |
3261 | x = mTodoEditor->geometry().x(); | 3256 | x = mTodoEditor->geometry().x(); |
3262 | y = mTodoEditor->geometry().y(); | 3257 | y = mTodoEditor->geometry().y(); |
3263 | w = mTodoEditor->width(); | 3258 | w = mTodoEditor->width(); |
3264 | h = mTodoEditor->height(); | 3259 | h = mTodoEditor->height(); |
3265 | mTodoEditor->show(); | 3260 | mTodoEditor->show(); |
3266 | mTodoEditor->setGeometry(x,y,w,h); | 3261 | mTodoEditor->setGeometry(x,y,w,h); |
3267 | #else | 3262 | #else |
3268 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 3263 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
3269 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 3264 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
3270 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 3265 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
3271 | qApp->processEvents(); | 3266 | qApp->processEvents(); |
3272 | delete mTodoEditor; | 3267 | delete mTodoEditor; |
3273 | mTodoEditor = mDialogManager->getTodoEditor(); | 3268 | mTodoEditor = mDialogManager->getTodoEditor(); |
3274 | topLevelWidget()->setCaption( i18n("") ); | 3269 | topLevelWidget()->setCaption( i18n("") ); |
3275 | } | 3270 | } |
3276 | mTodoEditor->showMaximized(); | 3271 | mTodoEditor->showMaximized(); |
3277 | #endif | 3272 | #endif |
3278 | } | 3273 | } |
3279 | 3274 | ||
3280 | void CalendarView::cloneIncidence() | 3275 | void CalendarView::cloneIncidence() |
3281 | { | 3276 | { |
3282 | Incidence *incidence = currentSelection(); | 3277 | Incidence *incidence = currentSelection(); |
3283 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3278 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3284 | if ( incidence ) { | 3279 | if ( incidence ) { |
3285 | cloneIncidence(incidence); | 3280 | cloneIncidence(incidence); |
3286 | } | 3281 | } |
3287 | } | 3282 | } |
3288 | void CalendarView::moveIncidence() | 3283 | void CalendarView::moveIncidence() |
3289 | { | 3284 | { |
3290 | Incidence *incidence = currentSelection(); | 3285 | Incidence *incidence = currentSelection(); |
3291 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3286 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3292 | if ( incidence ) { | 3287 | if ( incidence ) { |
3293 | moveIncidence(incidence); | 3288 | moveIncidence(incidence); |
3294 | } | 3289 | } |
3295 | } | 3290 | } |
3296 | void CalendarView::beamIncidence() | 3291 | void CalendarView::beamIncidence() |
3297 | { | 3292 | { |
3298 | Incidence *incidence = currentSelection(); | 3293 | Incidence *incidence = currentSelection(); |
3299 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3294 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3300 | if ( incidence ) { | 3295 | if ( incidence ) { |
3301 | beamIncidence(incidence); | 3296 | beamIncidence(incidence); |
3302 | } | 3297 | } |
3303 | } | 3298 | } |
3304 | void CalendarView::toggleCancelIncidence() | 3299 | void CalendarView::toggleCancelIncidence() |
3305 | { | 3300 | { |
3306 | Incidence *incidence = currentSelection(); | 3301 | Incidence *incidence = currentSelection(); |
3307 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3302 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3308 | if ( incidence ) { | 3303 | if ( incidence ) { |
3309 | cancelIncidence(incidence); | 3304 | cancelIncidence(incidence); |
3310 | } | 3305 | } |
3311 | } | 3306 | } |
3312 | 3307 | ||
3313 | 3308 | ||
3314 | void CalendarView::cancelIncidence(Incidence * inc ) | 3309 | void CalendarView::cancelIncidence(Incidence * inc ) |
3315 | { | 3310 | { |
3316 | inc->setCancelled( ! inc->cancelled() ); | 3311 | inc->setCancelled( ! inc->cancelled() ); |
3317 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 3312 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
3318 | updateView(); | 3313 | updateView(); |
3319 | } | 3314 | } |
3320 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 3315 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
3321 | { | 3316 | { |
3322 | Incidence * newInc = orgInc->clone(); | 3317 | Incidence * newInc = orgInc->clone(); |
3323 | newInc->recreate(); | 3318 | newInc->recreate(); |
3324 | 3319 | ||
3325 | if ( newInc->typeID() == todoID ) { | 3320 | if ( newInc->typeID() == todoID ) { |
3326 | Todo* t = (Todo*) newInc; | 3321 | Todo* t = (Todo*) newInc; |
3327 | bool cloneSub = false; | 3322 | bool cloneSub = false; |
3328 | if ( orgInc->relations().count() ) { | 3323 | if ( orgInc->relations().count() ) { |
3329 | int result = KMessageBox::warningYesNoCancel(this, | 3324 | int result = KMessageBox::warningYesNoCancel(this, |
3330 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( KGlobal::formatMessage ( newInc->summary(),0 ) ), | 3325 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( KGlobal::formatMessage ( newInc->summary(),0 ) ), |
3331 | i18n("Todo has subtodos"), | 3326 | i18n("Todo has subtodos"), |
3332 | i18n("Yes"), | 3327 | i18n("Yes"), |
3333 | i18n("No")); | 3328 | i18n("No")); |
3334 | 3329 | ||
3335 | if ( result == KMessageBox::Cancel ) { | 3330 | if ( result == KMessageBox::Cancel ) { |
3336 | delete t; | 3331 | delete t; |
3337 | return; | 3332 | return; |
3338 | } | 3333 | } |
3339 | if (result == KMessageBox::Yes) cloneSub = true; | 3334 | if (result == KMessageBox::Yes) cloneSub = true; |
3340 | } | 3335 | } |
3341 | showTodoEditor(); | 3336 | showTodoEditor(); |
3342 | mTodoEditor->editTodo( t ); | 3337 | mTodoEditor->editTodo( t ); |
3343 | if ( mTodoEditor->exec() ) { | 3338 | if ( mTodoEditor->exec() ) { |
3344 | if ( cloneSub ) { | 3339 | if ( cloneSub ) { |
3345 | orgInc->cloneRelations( t ); | 3340 | orgInc->cloneRelations( t ); |
3346 | mCalendar->addIncidenceBranch( t ); | 3341 | mCalendar->addIncidenceBranch( t ); |
3347 | updateView(); | 3342 | updateView(); |
3348 | 3343 | ||
3349 | } else { | 3344 | } else { |
3350 | mCalendar->addTodo( t ); | 3345 | mCalendar->addTodo( t ); |
3351 | updateView(); | 3346 | updateView(); |
3352 | } | 3347 | } |
3353 | } else { | 3348 | } else { |
3354 | delete t; | 3349 | delete t; |
3355 | } | 3350 | } |
3356 | } | 3351 | } |
3357 | else if ( newInc->typeID() == eventID ) { | 3352 | else if ( newInc->typeID() == eventID ) { |
3358 | Event* e = (Event*) newInc; | 3353 | Event* e = (Event*) newInc; |
3359 | showEventEditor(); | 3354 | showEventEditor(); |
3360 | mEventEditor->editEvent( e ); | 3355 | mEventEditor->editEvent( e ); |
3361 | if ( mEventEditor->exec() ) { | 3356 | if ( mEventEditor->exec() ) { |
3362 | mCalendar->addEvent( e ); | 3357 | mCalendar->addEvent( e ); |
3363 | updateView(); | 3358 | updateView(); |
3364 | } else { | 3359 | } else { |
3365 | delete e; | 3360 | delete e; |
3366 | } | 3361 | } |
3367 | } if ( newInc->typeID() == journalID ) { | 3362 | } if ( newInc->typeID() == journalID ) { |
3368 | mCalendar->addJournal( (Journal*) newInc ); | 3363 | mCalendar->addJournal( (Journal*) newInc ); |
3369 | editJournal( (Journal*) newInc ); | 3364 | editJournal( (Journal*) newInc ); |
3370 | } | 3365 | } |
3371 | setActiveWindow(); | 3366 | setActiveWindow(); |
3372 | } | 3367 | } |
3373 | 3368 | ||
3374 | void CalendarView::newEvent() | 3369 | void CalendarView::newEvent() |
3375 | { | 3370 | { |
3376 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 3371 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
3377 | KOAgendaView *aView = mViewManager->agendaView(); | 3372 | KOAgendaView *aView = mViewManager->agendaView(); |
3378 | if (aView) { | 3373 | if (aView) { |
3379 | if (aView->selectionStart().isValid()) { | 3374 | if (aView->selectionStart().isValid()) { |
3380 | if (aView->selectedIsAllDay()) { | 3375 | if (aView->selectedIsAllDay()) { |
3381 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 3376 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
3382 | } else { | 3377 | } else { |
3383 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 3378 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
3384 | } | 3379 | } |
3385 | return; | 3380 | return; |
3386 | } | 3381 | } |
3387 | } | 3382 | } |
3388 | 3383 | ||
3389 | QDate date = mNavigator->selectedDates().first(); | 3384 | QDate date = mNavigator->selectedDates().first(); |
3390 | #if 0 | 3385 | #if 0 |
3391 | QDateTime current = QDateTime::currentDateTime(); | 3386 | QDateTime current = QDateTime::currentDateTime(); |
3392 | if ( date <= current.date() ) { | 3387 | if ( date <= current.date() ) { |
3393 | int hour = current.time().hour() +1; | 3388 | int hour = current.time().hour() +1; |
3394 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 3389 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
3395 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3390 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3396 | } else | 3391 | } else |
3397 | #endif | 3392 | #endif |
3398 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 3393 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
3399 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 3394 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
3400 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3395 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3401 | } | 3396 | } |
3402 | 3397 | ||
3403 | void CalendarView::newEvent(QDateTime fh) | 3398 | void CalendarView::newEvent(QDateTime fh) |
3404 | { | 3399 | { |
3405 | newEvent(fh, | 3400 | newEvent(fh, |
3406 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 3401 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
3407 | } | 3402 | } |
3408 | 3403 | ||
3409 | void CalendarView::newEvent(QDate dt) | 3404 | void CalendarView::newEvent(QDate dt) |
3410 | { | 3405 | { |
3411 | newEvent(QDateTime(dt, QTime(0,0,0)), | 3406 | newEvent(QDateTime(dt, QTime(0,0,0)), |
3412 | QDateTime(dt, QTime(0,0,0)), true); | 3407 | QDateTime(dt, QTime(0,0,0)), true); |
3413 | } | 3408 | } |
3414 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 3409 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
3415 | { | 3410 | { |
3416 | newEvent(fromHint, toHint, false); | 3411 | newEvent(fromHint, toHint, false); |
3417 | } | 3412 | } |
3418 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 3413 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
3419 | { | 3414 | { |
3420 | 3415 | ||
3421 | showEventEditor(); | 3416 | showEventEditor(); |
3422 | mEventEditor->newEvent(fromHint,toHint,allDay); | 3417 | mEventEditor->newEvent(fromHint,toHint,allDay); |
3423 | if ( mFilterView->filtersEnabled() ) { | 3418 | if ( mFilterView->filtersEnabled() ) { |
3424 | CalFilter *filter = mFilterView->selectedFilter(); | 3419 | CalFilter *filter = mFilterView->selectedFilter(); |
3425 | if (filter && filter->showCategories()) { | 3420 | if (filter && filter->showCategories()) { |
3426 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 3421 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
3427 | } | 3422 | } |
3428 | if ( filter ) | 3423 | if ( filter ) |
3429 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 3424 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
3430 | } | 3425 | } |
3431 | mEventEditor->exec(); | 3426 | mEventEditor->exec(); |
3432 | setActiveWindow(); | 3427 | setActiveWindow(); |
3433 | } | 3428 | } |
3434 | void CalendarView::todoAdded(Todo * t) | 3429 | void CalendarView::todoAdded(Todo * t) |
3435 | { | 3430 | { |
3436 | 3431 | ||
3437 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 3432 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
3438 | updateTodoViews(); | 3433 | updateTodoViews(); |
3439 | } | 3434 | } |
3440 | void CalendarView::todoChanged(Todo * t) | 3435 | void CalendarView::todoChanged(Todo * t) |
3441 | { | 3436 | { |
3442 | emit todoModified( t, 4 ); | 3437 | emit todoModified( t, 4 ); |
3443 | // updateTodoViews(); | 3438 | // updateTodoViews(); |
3444 | } | 3439 | } |
3445 | void CalendarView::todoToBeDeleted(Todo *) | 3440 | void CalendarView::todoToBeDeleted(Todo *) |
3446 | { | 3441 | { |
3447 | //qDebug("todoToBeDeleted(Todo *) "); | 3442 | //qDebug("todoToBeDeleted(Todo *) "); |
3448 | updateTodoViews(); | 3443 | updateTodoViews(); |
3449 | } | 3444 | } |
3450 | void CalendarView::todoDeleted() | 3445 | void CalendarView::todoDeleted() |
3451 | { | 3446 | { |
3452 | //qDebug(" todoDeleted()"); | 3447 | //qDebug(" todoDeleted()"); |
3453 | updateTodoViews(); | 3448 | updateTodoViews(); |
3454 | } | 3449 | } |
3455 | 3450 | ||
3456 | 3451 | ||
3457 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 3452 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
3458 | { | 3453 | { |
3459 | showTodoEditor(); | 3454 | showTodoEditor(); |
3460 | mTodoEditor->newTodo(dt,0,allday); | 3455 | mTodoEditor->newTodo(dt,0,allday); |
3461 | if ( mFilterView->filtersEnabled() ) { | 3456 | if ( mFilterView->filtersEnabled() ) { |
3462 | CalFilter *filter = mFilterView->selectedFilter(); | 3457 | CalFilter *filter = mFilterView->selectedFilter(); |
3463 | if (filter && filter->showCategories()) { | 3458 | if (filter && filter->showCategories()) { |
3464 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 3459 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
3465 | } | 3460 | } |
3466 | if ( filter ) | 3461 | if ( filter ) |
3467 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 3462 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
3468 | } | 3463 | } |
3469 | mTodoEditor->exec(); | 3464 | mTodoEditor->exec(); |
3470 | setActiveWindow(); | 3465 | setActiveWindow(); |
3471 | } | 3466 | } |
3472 | 3467 | ||
3473 | void CalendarView::newTodo() | 3468 | void CalendarView::newTodo() |
3474 | { | 3469 | { |
3475 | newTodoDateTime( QDateTime(),true ); | 3470 | newTodoDateTime( QDateTime(),true ); |
3476 | } | 3471 | } |
3477 | 3472 | ||
3478 | void CalendarView::newSubTodo() | 3473 | void CalendarView::newSubTodo() |
3479 | { | 3474 | { |
3480 | Todo *todo = selectedTodo(); | 3475 | Todo *todo = selectedTodo(); |
3481 | if ( todo ) newSubTodo( todo ); | 3476 | if ( todo ) newSubTodo( todo ); |
3482 | } | 3477 | } |
3483 | 3478 | ||
3484 | void CalendarView::newSubTodo(Todo *parentEvent) | 3479 | void CalendarView::newSubTodo(Todo *parentEvent) |
3485 | { | 3480 | { |
3486 | 3481 | ||
3487 | showTodoEditor(); | 3482 | showTodoEditor(); |
3488 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 3483 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
3489 | mTodoEditor->exec(); | 3484 | mTodoEditor->exec(); |
3490 | setActiveWindow(); | 3485 | setActiveWindow(); |
3491 | } | 3486 | } |
3492 | 3487 | ||
3493 | void CalendarView::newFloatingEvent() | 3488 | void CalendarView::newFloatingEvent() |
3494 | { | 3489 | { |
3495 | DateList tmpList = mNavigator->selectedDates(); | 3490 | DateList tmpList = mNavigator->selectedDates(); |
3496 | QDate date = tmpList.first(); | 3491 | QDate date = tmpList.first(); |
3497 | 3492 | ||
3498 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 3493 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
3499 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 3494 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
3500 | } | 3495 | } |
3501 | 3496 | ||
3502 | 3497 | ||
3503 | void CalendarView::editEvent( Event *event ) | 3498 | void CalendarView::editEvent( Event *event ) |
3504 | { | 3499 | { |
3505 | 3500 | ||
3506 | if ( !event ) return; | 3501 | if ( !event ) return; |
3507 | if ( event->isReadOnly() ) { | 3502 | if ( event->isReadOnly() ) { |
3508 | showEvent( event ); | 3503 | showEvent( event ); |
3509 | return; | 3504 | return; |
3510 | } | 3505 | } |
3511 | showEventEditor(); | 3506 | showEventEditor(); |
3512 | mEventEditor->editEvent( event , mFlagEditDescription); | 3507 | mEventEditor->editEvent( event , mFlagEditDescription); |
3513 | mEventEditor->exec(); | 3508 | mEventEditor->exec(); |
3514 | setActiveWindow(); | 3509 | setActiveWindow(); |
3515 | 3510 | ||
3516 | } | 3511 | } |
3517 | void CalendarView::editJournal( Journal *jour ) | 3512 | void CalendarView::editJournal( Journal *jour ) |
3518 | { | 3513 | { |
3519 | if ( !jour ) return; | 3514 | if ( !jour ) return; |
3520 | mDialogManager->hideSearchDialog(); | 3515 | mDialogManager->hideSearchDialog(); |
3521 | mViewManager->showJournalView(); | 3516 | mViewManager->showJournalView(); |
3522 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 3517 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
3523 | } | 3518 | } |
3524 | void CalendarView::editTodo( Todo *todo ) | 3519 | void CalendarView::editTodo( Todo *todo ) |
3525 | { | 3520 | { |
3526 | if ( !todo ) return; | 3521 | if ( !todo ) return; |
3527 | 3522 | ||
3528 | if ( todo->isReadOnly() ) { | 3523 | if ( todo->isReadOnly() ) { |
3529 | showTodo( todo ); | 3524 | showTodo( todo ); |
3530 | return; | 3525 | return; |
3531 | } | 3526 | } |
3532 | showTodoEditor(); | 3527 | showTodoEditor(); |
3533 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 3528 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
3534 | mTodoEditor->exec(); | 3529 | mTodoEditor->exec(); |
3535 | setActiveWindow(); | 3530 | setActiveWindow(); |
3536 | 3531 | ||
3537 | } | 3532 | } |
3538 | 3533 | ||
3539 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 3534 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
3540 | { | 3535 | { |
3541 | if ( !mEventViewerDialog ) { | 3536 | if ( !mEventViewerDialog ) { |
3542 | mEventViewerDialog = new KOEventViewerDialog(0); | 3537 | mEventViewerDialog = new KOEventViewerDialog(0); |
3543 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 3538 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
3544 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 3539 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
3545 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 3540 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
3546 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 3541 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
3547 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 3542 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
3548 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 3543 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
3549 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | 3544 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), |
3550 | this, SLOT( slotViewerClosed() ) ); | 3545 | this, SLOT( slotViewerClosed() ) ); |
3551 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 3546 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
3552 | this, SLOT( todoChanged(Todo *) ) ); | 3547 | this, SLOT( todoChanged(Todo *) ) ); |
3553 | connect( mEventViewerDialog, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 3548 | connect( mEventViewerDialog, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
3554 | mEventViewerDialog->resize( 640, 480 ); | 3549 | mEventViewerDialog->resize( 640, 480 ); |
3555 | 3550 | ||
3556 | } | 3551 | } |
3557 | return mEventViewerDialog; | 3552 | return mEventViewerDialog; |
3558 | } | 3553 | } |
3559 | void CalendarView::showEvent(Event *event) | 3554 | void CalendarView::showEvent(Event *event) |
3560 | { | 3555 | { |
3561 | getEventViewerDialog()->setEvent(event); | 3556 | getEventViewerDialog()->setEvent(event); |
3562 | getEventViewerDialog()->showMe(); | 3557 | getEventViewerDialog()->showMe(); |
3563 | } | 3558 | } |
3564 | 3559 | ||
3565 | void CalendarView::showTodo(Todo *event) | 3560 | void CalendarView::showTodo(Todo *event) |
3566 | { | 3561 | { |
3567 | getEventViewerDialog()->setTodo(event); | 3562 | getEventViewerDialog()->setTodo(event); |
3568 | getEventViewerDialog()->showMe(); | 3563 | getEventViewerDialog()->showMe(); |
3569 | } | 3564 | } |
3570 | void CalendarView::showJournal( Journal *jour ) | 3565 | void CalendarView::showJournal( Journal *jour ) |
3571 | { | 3566 | { |
3572 | getEventViewerDialog()->setJournal(jour); | 3567 | getEventViewerDialog()->setJournal(jour); |
3573 | getEventViewerDialog()->showMe(); | 3568 | getEventViewerDialog()->showMe(); |
3574 | 3569 | ||
3575 | } | 3570 | } |
3576 | // void CalendarView::todoModified (Todo *event, int changed) | 3571 | // void CalendarView::todoModified (Todo *event, int changed) |
3577 | // { | 3572 | // { |
3578 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 3573 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
3579 | // // kdDebug() << "Todo modified and open" << endl; | 3574 | // // kdDebug() << "Todo modified and open" << endl; |
3580 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 3575 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
3581 | // // temp->modified (changed); | 3576 | // // temp->modified (changed); |
3582 | 3577 | ||
3583 | // // } | 3578 | // // } |
3584 | 3579 | ||
3585 | // mViewManager->updateView(); | 3580 | // mViewManager->updateView(); |
3586 | // } | 3581 | // } |
3587 | 3582 | ||
3588 | void CalendarView::appointment_show() | 3583 | void CalendarView::appointment_show() |
3589 | { | 3584 | { |
3590 | Event *anEvent = 0; | 3585 | Event *anEvent = 0; |
3591 | 3586 | ||
3592 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3587 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3593 | 3588 | ||
3594 | if (mViewManager->currentView()->isEventView()) { | 3589 | if (mViewManager->currentView()->isEventView()) { |
3595 | if ( incidence && incidence->typeID() == eventID ) { | 3590 | if ( incidence && incidence->typeID() == eventID ) { |
3596 | anEvent = static_cast<Event *>(incidence); | 3591 | anEvent = static_cast<Event *>(incidence); |
3597 | } | 3592 | } |
3598 | } | 3593 | } |
3599 | 3594 | ||
3600 | if (!anEvent) { | 3595 | if (!anEvent) { |
3601 | KNotifyClient::beep(); | 3596 | KNotifyClient::beep(); |
3602 | return; | 3597 | return; |
3603 | } | 3598 | } |
3604 | 3599 | ||
3605 | showEvent(anEvent); | 3600 | showEvent(anEvent); |
3606 | } | 3601 | } |
3607 | 3602 | ||
3608 | void CalendarView::appointment_edit() | 3603 | void CalendarView::appointment_edit() |
3609 | { | 3604 | { |
3610 | Event *anEvent = 0; | 3605 | Event *anEvent = 0; |
3611 | 3606 | ||
3612 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3607 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3613 | 3608 | ||
3614 | if (mViewManager->currentView()->isEventView()) { | 3609 | if (mViewManager->currentView()->isEventView()) { |
3615 | if ( incidence && incidence->typeID() == eventID ) { | 3610 | if ( incidence && incidence->typeID() == eventID ) { |
3616 | anEvent = static_cast<Event *>(incidence); | 3611 | anEvent = static_cast<Event *>(incidence); |
3617 | } | 3612 | } |
3618 | } | 3613 | } |
3619 | 3614 | ||
3620 | if (!anEvent) { | 3615 | if (!anEvent) { |
3621 | KNotifyClient::beep(); | 3616 | KNotifyClient::beep(); |
3622 | return; | 3617 | return; |
3623 | } | 3618 | } |
3624 | 3619 | ||
3625 | editEvent(anEvent); | 3620 | editEvent(anEvent); |
3626 | } | 3621 | } |
3627 | 3622 | ||
3628 | void CalendarView::appointment_delete() | 3623 | void CalendarView::appointment_delete() |
3629 | { | 3624 | { |
3630 | Event *anEvent = 0; | 3625 | Event *anEvent = 0; |
3631 | 3626 | ||
3632 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3627 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3633 | 3628 | ||
3634 | if (mViewManager->currentView()->isEventView()) { | 3629 | if (mViewManager->currentView()->isEventView()) { |
3635 | if ( incidence && incidence->typeID() == eventID ) { | 3630 | if ( incidence && incidence->typeID() == eventID ) { |
3636 | anEvent = static_cast<Event *>(incidence); | 3631 | anEvent = static_cast<Event *>(incidence); |
3637 | } | 3632 | } |
3638 | } | 3633 | } |
3639 | 3634 | ||
3640 | if (!anEvent) { | 3635 | if (!anEvent) { |
3641 | KNotifyClient::beep(); | 3636 | KNotifyClient::beep(); |
3642 | return; | 3637 | return; |
3643 | } | 3638 | } |
3644 | 3639 | ||
3645 | deleteEvent(anEvent); | 3640 | deleteEvent(anEvent); |
3646 | } | 3641 | } |
3647 | 3642 | ||
3648 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3643 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
3649 | { | 3644 | { |
3650 | if (!sub) return; | 3645 | if (!sub) return; |
3651 | if ( sub->relatedTo() == parent ) | 3646 | if ( sub->relatedTo() == parent ) |
3652 | return; | 3647 | return; |
3653 | sub->setRelatedTo(parent); | 3648 | sub->setRelatedTo(parent); |
3654 | sub->updated(); | 3649 | sub->updated(); |
3655 | setModified(true); | 3650 | setModified(true); |
3656 | updateView(); | 3651 | updateView(); |
3657 | } | 3652 | } |
3658 | void CalendarView::todo_unsub(Todo *anTodo ) | 3653 | void CalendarView::todo_unsub(Todo *anTodo ) |
3659 | { | 3654 | { |
3660 | todo_resub( 0, anTodo ); | 3655 | todo_resub( 0, anTodo ); |
3661 | } | 3656 | } |
3662 | 3657 | ||
3663 | void CalendarView::deleteTodo(Todo *todo) | 3658 | void CalendarView::deleteTodo(Todo *todo) |
3664 | { | 3659 | { |
3665 | if (!todo) { | 3660 | if (!todo) { |
3666 | KNotifyClient::beep(); | 3661 | KNotifyClient::beep(); |
3667 | return; | 3662 | return; |
3668 | } | 3663 | } |
3669 | if (KOPrefs::instance()->mConfirm) { | 3664 | if (KOPrefs::instance()->mConfirm) { |
3670 | QString text = KGlobal::formatMessage ( todo->summary(),0 ); | 3665 | QString text = KGlobal::formatMessage ( todo->summary(),0 ); |
3671 | if (!todo->relations().isEmpty()) { | 3666 | if (!todo->relations().isEmpty()) { |
3672 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3667 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3673 | 3668 | ||
3674 | } | 3669 | } |
3675 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { | 3670 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { |
3676 | case KMessageBox::Continue: // OK | 3671 | case KMessageBox::Continue: // OK |
3677 | bool deleteT = false; | 3672 | bool deleteT = false; |
3678 | if (!todo->relations().isEmpty()) { | 3673 | if (!todo->relations().isEmpty()) { |
3679 | deleteT = removeCompletedSubTodos( todo ); | 3674 | deleteT = removeCompletedSubTodos( todo ); |
3680 | } | 3675 | } |
3681 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3676 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3682 | if ( !deleteT ) { | 3677 | if ( !deleteT ) { |
3683 | checkExternalId( todo ); | 3678 | checkExternalId( todo ); |
3684 | calendar()->deleteTodo(todo); | 3679 | calendar()->deleteTodo(todo); |
3685 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3680 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3686 | updateView(); | 3681 | updateView(); |
3687 | } | 3682 | } |
3688 | break; | 3683 | break; |
3689 | } // switch | 3684 | } // switch |
3690 | } else { | 3685 | } else { |
3691 | checkExternalId( todo ); | 3686 | checkExternalId( todo ); |
3692 | mCalendar->deleteTodo(todo); | 3687 | mCalendar->deleteTodo(todo); |
3693 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3688 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3694 | updateView(); | 3689 | updateView(); |
3695 | } | 3690 | } |
3696 | 3691 | ||
3697 | emit updateSearchDialog(); | 3692 | emit updateSearchDialog(); |
3698 | } | 3693 | } |
3699 | void CalendarView::deleteJournal(Journal *jour) | 3694 | void CalendarView::deleteJournal(Journal *jour) |
3700 | { | 3695 | { |
3701 | if (!jour) { | 3696 | if (!jour) { |
3702 | KNotifyClient::beep(); | 3697 | KNotifyClient::beep(); |
3703 | return; | 3698 | return; |
3704 | } | 3699 | } |
3705 | if (KOPrefs::instance()->mConfirm) { | 3700 | if (KOPrefs::instance()->mConfirm) { |
3706 | 3701 | ||
3707 | QString des; | 3702 | QString des; |
3708 | if ( !jour->summary().isEmpty() ) { | 3703 | if ( !jour->summary().isEmpty() ) { |
3709 | des = jour->summary(); | 3704 | des = jour->summary(); |
3710 | } else { | 3705 | } else { |
3711 | des = jour->description().left(30); | 3706 | des = jour->description().left(30); |
3712 | des = des.simplifyWhiteSpace (); | 3707 | des = des.simplifyWhiteSpace (); |
3713 | des.replace (QRegExp ("\\n"),"" ); | 3708 | des.replace (QRegExp ("\\n"),"" ); |
3714 | des.replace (QRegExp ("\\r"),"" ); | 3709 | des.replace (QRegExp ("\\r"),"" ); |
3715 | } | 3710 | } |
3716 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { | 3711 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { |
3717 | case KMessageBox::Continue: // OK | 3712 | case KMessageBox::Continue: // OK |
3718 | calendar()->deleteJournal(jour); | 3713 | calendar()->deleteJournal(jour); |
3719 | updateView(); | 3714 | updateView(); |
3720 | break; | 3715 | break; |
3721 | } // switch | 3716 | } // switch |
3722 | } else { | 3717 | } else { |
3723 | calendar()->deleteJournal(jour);; | 3718 | calendar()->deleteJournal(jour);; |
3724 | updateView(); | 3719 | updateView(); |
3725 | } | 3720 | } |
3726 | emit updateSearchDialog(); | 3721 | emit updateSearchDialog(); |
3727 | } | 3722 | } |
3728 | 3723 | ||
3729 | void CalendarView::deleteEvent(Event *anEvent) | 3724 | void CalendarView::deleteEvent(Event *anEvent) |
3730 | { | 3725 | { |
3731 | if (!anEvent) { | 3726 | if (!anEvent) { |
3732 | KNotifyClient::beep(); | 3727 | KNotifyClient::beep(); |
3733 | return; | 3728 | return; |
3734 | } | 3729 | } |
3735 | 3730 | ||
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 456c2d7..1debef7 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,668 +1,667 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #include <qscrollbar.h> | 33 | #include <qscrollbar.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qtopia/ir.h> | 35 | #include <qtopia/ir.h> |
36 | #else | 36 | #else |
37 | #define Ir char | 37 | #define Ir char |
38 | #endif | 38 | #endif |
39 | #include <libkcal/calendar.h> | 39 | #include <libkcal/calendar.h> |
40 | #include <libkcal/scheduler.h> | 40 | #include <libkcal/scheduler.h> |
41 | #include <libkcal/calendarresources.h> | 41 | #include <libkcal/calendarresources.h> |
42 | #include <libkcal/resourcecalendar.h> | 42 | #include <libkcal/resourcecalendar.h> |
43 | #include <KDGanttMinimizeSplitter.h> | 43 | #include <KDGanttMinimizeSplitter.h> |
44 | 44 | ||
45 | #include <korganizer/calendarviewbase.h> | 45 | #include <korganizer/calendarviewbase.h> |
46 | 46 | ||
47 | #include <ksyncmanager.h> | 47 | #include <ksyncmanager.h> |
48 | //#include <koprefs.h> | 48 | //#include <koprefs.h> |
49 | 49 | ||
50 | class QWidgetStack; | 50 | class QWidgetStack; |
51 | class QSplitter; | 51 | class QSplitter; |
52 | class KopiCalendarFile; | 52 | class KopiCalendarFile; |
53 | class CalPrinter; | 53 | class CalPrinter; |
54 | class KOFilterView; | 54 | class KOFilterView; |
55 | class KOCalEditView; | 55 | class KOCalEditView; |
56 | class KOViewManager; | 56 | class KOViewManager; |
57 | class KODialogManager; | 57 | class KODialogManager; |
58 | class KOTodoView; | 58 | class KOTodoView; |
59 | class KDateNavigator; | 59 | class KDateNavigator; |
60 | class DateNavigatorContainer; | 60 | class DateNavigatorContainer; |
61 | class DateNavigator; | 61 | class DateNavigator; |
62 | class KOIncidenceEditor; | 62 | class KOIncidenceEditor; |
63 | class KDatePicker; | 63 | class KDatePicker; |
64 | class ResourceView; | 64 | class ResourceView; |
65 | class KOEventEditor; | 65 | class KOEventEditor; |
66 | class KOTodoEditor ; | 66 | class KOTodoEditor ; |
67 | class KOEventViewerDialog; | 67 | class KOEventViewerDialog; |
68 | class KOBeamPrefs; | 68 | class KOBeamPrefs; |
69 | class KSyncProfile; | 69 | class KSyncProfile; |
70 | class AlarmDialog; | 70 | class AlarmDialog; |
71 | class KCal::Attendee; | 71 | class KCal::Attendee; |
72 | 72 | ||
73 | namespace KCal { class FileStorage; } | 73 | namespace KCal { class FileStorage; } |
74 | 74 | ||
75 | using namespace KCal; | 75 | using namespace KCal; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | This is the main calendar widget. It provides the different vies on t he | 78 | This is the main calendar widget. It provides the different vies on t he |
79 | calendar data as well as the date navigator. It also handles synchronisation | 79 | calendar data as well as the date navigator. It also handles synchronisation |
80 | of the different views and controls the different dialogs like preferences, | 80 | of the different views and controls the different dialogs like preferences, |
81 | event editor, search dialog etc. | 81 | event editor, search dialog etc. |
82 | 82 | ||
83 | @short main calendar view widget | 83 | @short main calendar view widget |
84 | @author Cornelius Schumacher | 84 | @author Cornelius Schumacher |
85 | */ | 85 | */ |
86 | 86 | ||
87 | #include <qtextbrowser.h> | 87 | #include <qtextbrowser.h> |
88 | #include <qtextcodec.h> | 88 | #include <qtextcodec.h> |
89 | 89 | ||
90 | class MissedAlarmTextBrowser : public QTextBrowser { | 90 | class MissedAlarmTextBrowser : public QTextBrowser { |
91 | Q_OBJECT | 91 | Q_OBJECT |
92 | public: | 92 | public: |
93 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); | 93 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); |
94 | ~MissedAlarmTextBrowser(); | 94 | ~MissedAlarmTextBrowser(); |
95 | void setSource(const QString & n); | 95 | void setSource(const QString & n); |
96 | 96 | ||
97 | private: | 97 | private: |
98 | Incidence * getNextInc(QDateTime start ); | 98 | Incidence * getNextInc(QDateTime start ); |
99 | QPtrList<Incidence> mAlarms; | 99 | QPtrList<Incidence> mAlarms; |
100 | signals: | 100 | signals: |
101 | void showIncidence( QString uid); | 101 | void showIncidence( QString uid); |
102 | }; | 102 | }; |
103 | 103 | ||
104 | 104 | ||
105 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 105 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
106 | { | 106 | { |
107 | Q_OBJECT | 107 | Q_OBJECT |
108 | public: | 108 | public: |
109 | /** | 109 | /** |
110 | Constructs a new calendar view widget. | 110 | Constructs a new calendar view widget. |
111 | 111 | ||
112 | @param calendar calendar document | 112 | @param calendar calendar document |
113 | @param parent parent window | 113 | @param parent parent window |
114 | @param name Qt internal widget object name | 114 | @param name Qt internal widget object name |
115 | */ | 115 | */ |
116 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 116 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
117 | const char *name = 0 ); | 117 | const char *name = 0 ); |
118 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 118 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
119 | const char *name = 0 ); | 119 | const char *name = 0 ); |
120 | virtual ~CalendarView(); | 120 | virtual ~CalendarView(); |
121 | 121 | ||
122 | Calendar *calendar() { return mCalendar; } | 122 | Calendar *calendar() { return mCalendar; } |
123 | 123 | ||
124 | KOViewManager *viewManager(); | 124 | KOViewManager *viewManager(); |
125 | KODialogManager *dialogManager(); | 125 | KODialogManager *dialogManager(); |
126 | 126 | ||
127 | QDate startDate(); | 127 | QDate startDate(); |
128 | QDate endDate(); | 128 | QDate endDate(); |
129 | 129 | ||
130 | QWidgetStack *viewStack(); | 130 | QWidgetStack *viewStack(); |
131 | QWidget *leftFrame(); | 131 | QWidget *leftFrame(); |
132 | 132 | ||
133 | DateNavigator *dateNavigator(); | 133 | DateNavigator *dateNavigator(); |
134 | KDateNavigator *dateNavigatorWidget(); | 134 | KDateNavigator *dateNavigatorWidget(); |
135 | 135 | ||
136 | void addView(KOrg::BaseView *); | 136 | void addView(KOrg::BaseView *); |
137 | void showView(KOrg::BaseView *); | 137 | void showView(KOrg::BaseView *); |
138 | KOEventViewerDialog* getEventViewerDialog(); | 138 | KOEventViewerDialog* getEventViewerDialog(); |
139 | Incidence *currentSelection(); | 139 | Incidence *currentSelection(); |
140 | void checkSuspendAlarm(); | 140 | void checkSuspendAlarm(); |
141 | void mergeFile( QString fn ); | 141 | void mergeFile( QString fn ); |
142 | 142 | ||
143 | signals: | 143 | signals: |
144 | void save (); | 144 | void save (); |
145 | void saveStopTimer (); | 145 | void saveStopTimer (); |
146 | void tempDisableBR(bool); | 146 | void tempDisableBR(bool); |
147 | /** This todo has been modified */ | 147 | /** This todo has been modified */ |
148 | void todoModified(Todo *, int); | 148 | void todoModified(Todo *, int); |
149 | 149 | ||
150 | /** when change is made to options dialog, the topwidget will catch this | 150 | /** when change is made to options dialog, the topwidget will catch this |
151 | * and emit this signal which notifies all widgets which have registered | 151 | * and emit this signal which notifies all widgets which have registered |
152 | * for notification to update their settings. */ | 152 | * for notification to update their settings. */ |
153 | void configChanged(); | 153 | void configChanged(); |
154 | /** emitted when the topwidget is closing down, so that any attached | 154 | /** emitted when the topwidget is closing down, so that any attached |
155 | child windows can also close. */ | 155 | child windows can also close. */ |
156 | void closingDown(); | 156 | void closingDown(); |
157 | /** emitted right before we die */ | 157 | /** emitted right before we die */ |
158 | void closed(QWidget *); | 158 | void closed(QWidget *); |
159 | 159 | ||
160 | /** Emitted when state of modified flag changes */ | 160 | /** Emitted when state of modified flag changes */ |
161 | void modifiedChanged(bool); | 161 | void modifiedChanged(bool); |
162 | void signalmodified(); | 162 | void signalmodified(); |
163 | 163 | ||
164 | /** Emitted when state of read-only flag changes */ | 164 | /** Emitted when state of read-only flag changes */ |
165 | void readOnlyChanged(bool); | 165 | void readOnlyChanged(bool); |
166 | 166 | ||
167 | /** Emitted when the unit of navigation changes */ | 167 | /** Emitted when the unit of navigation changes */ |
168 | void changeNavStringPrev(const QString &); | 168 | void changeNavStringPrev(const QString &); |
169 | void changeNavStringNext(const QString &); | 169 | void changeNavStringNext(const QString &); |
170 | 170 | ||
171 | /** Emitted when state of events selection has changed and user is organizer*/ | 171 | /** Emitted when state of events selection has changed and user is organizer*/ |
172 | void organizerEventsSelected(bool); | 172 | void organizerEventsSelected(bool); |
173 | /** Emitted when state of events selection has changed and user is attendee*/ | 173 | /** Emitted when state of events selection has changed and user is attendee*/ |
174 | void groupEventsSelected(bool); | 174 | void groupEventsSelected(bool); |
175 | /** | 175 | /** |
176 | Emitted when an incidence gets selected. If the selection is cleared the | 176 | Emitted when an incidence gets selected. If the selection is cleared the |
177 | signal is emitted with 0 as argument. | 177 | signal is emitted with 0 as argument. |
178 | */ | 178 | */ |
179 | void incidenceSelected( Incidence * ); | 179 | void incidenceSelected( Incidence * ); |
180 | /** Emitted, when a todoitem is selected or deselected. */ | 180 | /** Emitted, when a todoitem is selected or deselected. */ |
181 | void todoSelected( bool ); | 181 | void todoSelected( bool ); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | Emitted, when clipboard content changes. Parameter indicates if paste | 184 | Emitted, when clipboard content changes. Parameter indicates if paste |
185 | is possible or not. | 185 | is possible or not. |
186 | */ | 186 | */ |
187 | void pasteEnabled(bool); | 187 | void pasteEnabled(bool); |
188 | 188 | ||
189 | /** Emitted, when the number of incoming messages has changed. */ | 189 | /** Emitted, when the number of incoming messages has changed. */ |
190 | void numIncomingChanged(int); | 190 | void numIncomingChanged(int); |
191 | 191 | ||
192 | /** Emitted, when the number of outgoing messages has changed. */ | 192 | /** Emitted, when the number of outgoing messages has changed. */ |
193 | void numOutgoingChanged(int); | 193 | void numOutgoingChanged(int); |
194 | 194 | ||
195 | /** Send status message, which can e.g. be displayed in the status bar. */ | 195 | /** Send status message, which can e.g. be displayed in the status bar. */ |
196 | void statusMessage(const QString &); | 196 | void statusMessage(const QString &); |
197 | 197 | ||
198 | void calendarViewExpanded( bool ); | 198 | void calendarViewExpanded( bool ); |
199 | void updateSearchDialog(); | 199 | void updateSearchDialog(); |
200 | void filtersUpdated(); | 200 | void filtersUpdated(); |
201 | 201 | ||
202 | 202 | ||
203 | public slots: | 203 | public slots: |
204 | void slotResetFocus(); | ||
205 | void nextConflict( bool all, bool allday ); | 204 | void nextConflict( bool all, bool allday ); |
206 | void conflictAll(); | 205 | void conflictAll(); |
207 | void conflictAllday(); | 206 | void conflictAllday(); |
208 | void conflictNotAll(); | 207 | void conflictNotAll(); |
209 | void setCalReadOnly( int id, bool readO ); | 208 | void setCalReadOnly( int id, bool readO ); |
210 | void checkAlarms(); | 209 | void checkAlarms(); |
211 | void checkFiles(); | 210 | void checkFiles(); |
212 | void slotprintSelInc(); | 211 | void slotprintSelInc(); |
213 | void showNextAlarms(); | 212 | void showNextAlarms(); |
214 | void showOpenError(); | 213 | void showOpenError(); |
215 | void watchSavedFile(); | 214 | void watchSavedFile(); |
216 | void recheckTimerAlarm(); | 215 | void recheckTimerAlarm(); |
217 | void checkNextTimerAlarm(); | 216 | void checkNextTimerAlarm(); |
218 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 217 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
219 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 218 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
220 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 219 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
221 | 220 | ||
222 | /** options dialog made a changed to the configuration. we catch this | 221 | /** options dialog made a changed to the configuration. we catch this |
223 | * and notify all widgets which need to update their configuration. */ | 222 | * and notify all widgets which need to update their configuration. */ |
224 | void updateConfig(); | 223 | void updateConfig(); |
225 | 224 | ||
226 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 225 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
227 | const QStringList& anniversaryList, const QStringList& realNameList, | 226 | const QStringList& anniversaryList, const QStringList& realNameList, |
228 | const QStringList& emailList, const QStringList& assembledNameList, | 227 | const QStringList& emailList, const QStringList& assembledNameList, |
229 | const QStringList& uidList); | 228 | const QStringList& uidList); |
230 | 229 | ||
231 | /** | 230 | /** |
232 | Load calendar from file \a filename. If \a merge is true, load | 231 | Load calendar from file \a filename. If \a merge is true, load |
233 | calendar into existing one, if it is false, clear calendar, before | 232 | calendar into existing one, if it is false, clear calendar, before |
234 | loading. Return true, if calendar could be successfully loaded. | 233 | loading. Return true, if calendar could be successfully loaded. |
235 | */ | 234 | */ |
236 | bool openCalendar(QString filename, bool merge=false); | 235 | bool openCalendar(QString filename, bool merge=false); |
237 | bool loadCalendars(); | 236 | bool loadCalendars(); |
238 | bool saveCalendars(); | 237 | bool saveCalendars(); |
239 | bool restoreCalendarSettings(); | 238 | bool restoreCalendarSettings(); |
240 | bool addCalendar( KopiCalendarFile * ); | 239 | bool addCalendar( KopiCalendarFile * ); |
241 | void addCalendarId( int id ); | 240 | void addCalendarId( int id ); |
242 | bool syncCalendar(QString filename,int mode = 0 ); | 241 | bool syncCalendar(QString filename,int mode = 0 ); |
243 | 242 | ||
244 | /** | 243 | /** |
245 | Save calendar data to file. Return true if calendar could be | 244 | Save calendar data to file. Return true if calendar could be |
246 | successfully saved. | 245 | successfully saved. |
247 | */ | 246 | */ |
248 | bool saveCalendar(QString filename); | 247 | bool saveCalendar(QString filename); |
249 | 248 | ||
250 | /** | 249 | /** |
251 | Close calendar. Clear calendar data and reset views to display an empty | 250 | Close calendar. Clear calendar data and reset views to display an empty |
252 | calendar. | 251 | calendar. |
253 | */ | 252 | */ |
254 | void closeCalendar(); | 253 | void closeCalendar(); |
255 | 254 | ||
256 | /** Archive old events of calendar */ | 255 | /** Archive old events of calendar */ |
257 | void archiveCalendar(); | 256 | void archiveCalendar(); |
258 | 257 | ||
259 | void showIncidence(); | 258 | void showIncidence(); |
260 | void editIncidence(); | 259 | void editIncidence(); |
261 | void editIncidenceDescription(); | 260 | void editIncidenceDescription(); |
262 | void deleteIncidence(); | 261 | void deleteIncidence(); |
263 | void cloneIncidence(); | 262 | void cloneIncidence(); |
264 | void moveIncidence(); | 263 | void moveIncidence(); |
265 | void beamIncidence(); | 264 | void beamIncidence(); |
266 | void toggleCancelIncidence(); | 265 | void toggleCancelIncidence(); |
267 | 266 | ||
268 | /** create an editeventwin with supplied date/time, and if bool is true, | 267 | /** create an editeventwin with supplied date/time, and if bool is true, |
269 | * make the event take all day. */ | 268 | * make the event take all day. */ |
270 | void newEvent(QDateTime, QDateTime, bool allDay ); | 269 | void newEvent(QDateTime, QDateTime, bool allDay ); |
271 | void newEvent(QDateTime, QDateTime); | 270 | void newEvent(QDateTime, QDateTime); |
272 | void newEvent(QDateTime fh); | 271 | void newEvent(QDateTime fh); |
273 | void newEvent(QDate dt); | 272 | void newEvent(QDate dt); |
274 | /** create new event without having a date hint. Takes current date as | 273 | /** create new event without having a date hint. Takes current date as |
275 | default hint. */ | 274 | default hint. */ |
276 | void newEvent(); | 275 | void newEvent(); |
277 | void newFloatingEvent(); | 276 | void newFloatingEvent(); |
278 | 277 | ||
279 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 278 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
280 | void showIncidence(Incidence *); | 279 | void showIncidence(Incidence *); |
281 | void showIncidence(QString uid); | 280 | void showIncidence(QString uid); |
282 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 281 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
283 | void editIncidence(Incidence *); | 282 | void editIncidence(Incidence *); |
284 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 283 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
285 | void deleteIncidence(Incidence *); | 284 | void deleteIncidence(Incidence *); |
286 | void cloneIncidence(Incidence *); | 285 | void cloneIncidence(Incidence *); |
287 | void cancelIncidence(Incidence *); | 286 | void cancelIncidence(Incidence *); |
288 | /** Create an editor for the supplied event. */ | 287 | /** Create an editor for the supplied event. */ |
289 | void editEvent(Event *); | 288 | void editEvent(Event *); |
290 | /** Delete the supplied event. */ | 289 | /** Delete the supplied event. */ |
291 | void deleteEvent(Event *); | 290 | void deleteEvent(Event *); |
292 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 291 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
293 | found. */ | 292 | found. */ |
294 | bool deleteEvent(const QString &uid); | 293 | bool deleteEvent(const QString &uid); |
295 | /** Create a read-only viewer dialog for the supplied event. */ | 294 | /** Create a read-only viewer dialog for the supplied event. */ |
296 | void showEvent(Event *); | 295 | void showEvent(Event *); |
297 | 296 | ||
298 | void editJournal(Journal *); | 297 | void editJournal(Journal *); |
299 | void showJournal(Journal *); | 298 | void showJournal(Journal *); |
300 | void deleteJournal(Journal *); | 299 | void deleteJournal(Journal *); |
301 | /** Create an editor dialog for a todo */ | 300 | /** Create an editor dialog for a todo */ |
302 | void editTodo(Todo *); | 301 | void editTodo(Todo *); |
303 | /** Create a read-only viewer dialog for the supplied todo */ | 302 | /** Create a read-only viewer dialog for the supplied todo */ |
304 | void showTodo(Todo *); | 303 | void showTodo(Todo *); |
305 | /** create new todo */ | 304 | /** create new todo */ |
306 | void newTodo(); | 305 | void newTodo(); |
307 | void newTodoDateTime(QDateTime, bool allday); | 306 | void newTodoDateTime(QDateTime, bool allday); |
308 | /** create new todo with a parent todo */ | 307 | /** create new todo with a parent todo */ |
309 | void newSubTodo(); | 308 | void newSubTodo(); |
310 | /** create new todo with a parent todo */ | 309 | /** create new todo with a parent todo */ |
311 | void newSubTodo(Todo *); | 310 | void newSubTodo(Todo *); |
312 | /** Delete todo */ | 311 | /** Delete todo */ |
313 | void deleteTodo(Todo *); | 312 | void deleteTodo(Todo *); |
314 | 313 | ||
315 | 314 | ||
316 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 315 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
317 | * emitted as result. */ | 316 | * emitted as result. */ |
318 | void checkClipboard(); | 317 | void checkClipboard(); |
319 | 318 | ||
320 | /** using the KConfig associated with the kapp variable, read in the | 319 | /** using the KConfig associated with the kapp variable, read in the |
321 | * settings from the config file. | 320 | * settings from the config file. |
322 | */ | 321 | */ |
323 | void readSettings(); | 322 | void readSettings(); |
324 | 323 | ||
325 | /** write current state to config file. */ | 324 | /** write current state to config file. */ |
326 | void writeSettings(); | 325 | void writeSettings(); |
327 | 326 | ||
328 | /** read settings for calendar filters */ | 327 | /** read settings for calendar filters */ |
329 | void readFilterSettings(KConfig *config); | 328 | void readFilterSettings(KConfig *config); |
330 | 329 | ||
331 | /** write settings for calendar filters */ | 330 | /** write settings for calendar filters */ |
332 | void writeFilterSettings(KConfig *config); | 331 | void writeFilterSettings(KConfig *config); |
333 | 332 | ||
334 | /** passes on the message that an event has changed to the currently | 333 | /** passes on the message that an event has changed to the currently |
335 | * activated view so that it can make appropriate display changes. */ | 334 | * activated view so that it can make appropriate display changes. */ |
336 | void changeEventDisplay(Event *, int); | 335 | void changeEventDisplay(Event *, int); |
337 | void changeIncidenceDisplay(Incidence *, int); | 336 | void changeIncidenceDisplay(Incidence *, int); |
338 | void changeTodoDisplay(Todo *, int); | 337 | void changeTodoDisplay(Todo *, int); |
339 | 338 | ||
340 | void eventAdded(Event *); | 339 | void eventAdded(Event *); |
341 | void eventChanged(Event *); | 340 | void eventChanged(Event *); |
342 | void eventToBeDeleted(Event *); | 341 | void eventToBeDeleted(Event *); |
343 | void eventDeleted(); | 342 | void eventDeleted(); |
344 | 343 | ||
345 | void todoAdded(Todo *); | 344 | void todoAdded(Todo *); |
346 | void todoChanged(Todo *); | 345 | void todoChanged(Todo *); |
347 | void todoToBeDeleted(Todo *); | 346 | void todoToBeDeleted(Todo *); |
348 | void todoDeleted(); | 347 | void todoDeleted(); |
349 | 348 | ||
350 | void updateView(const QDate &start, const QDate &end); | 349 | void updateView(const QDate &start, const QDate &end); |
351 | void updateView(); | 350 | void updateView(); |
352 | void clearAllViews(); | 351 | void clearAllViews(); |
353 | 352 | ||
354 | /** Full update of visible todo views */ | 353 | /** Full update of visible todo views */ |
355 | void updateTodoViews(); | 354 | void updateTodoViews(); |
356 | 355 | ||
357 | void updateUnmanagedViews(); | 356 | void updateUnmanagedViews(); |
358 | 357 | ||
359 | /** cut the current appointment to the clipboard */ | 358 | /** cut the current appointment to the clipboard */ |
360 | void edit_cut(); | 359 | void edit_cut(); |
361 | 360 | ||
362 | /** copy the current appointment(s) to the clipboard */ | 361 | /** copy the current appointment(s) to the clipboard */ |
363 | void edit_copy(); | 362 | void edit_copy(); |
364 | 363 | ||
365 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 364 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
366 | void edit_paste(); | 365 | void edit_paste(); |
367 | 366 | ||
368 | /** edit viewing and configuration options. */ | 367 | /** edit viewing and configuration options. */ |
369 | void edit_options(); | 368 | void edit_options(); |
370 | void edit_global_options(); | 369 | void edit_global_options(); |
371 | /** | 370 | /** |
372 | Functions for printing, previewing a print, and setting up printing | 371 | Functions for printing, previewing a print, and setting up printing |
373 | parameters. | 372 | parameters. |
374 | */ | 373 | */ |
375 | void print(); | 374 | void print(); |
376 | void printSetup(); | 375 | void printSetup(); |
377 | void printPreview(); | 376 | void printPreview(); |
378 | 377 | ||
379 | /** Export as iCalendar file */ | 378 | /** Export as iCalendar file */ |
380 | void exportICalendar(); | 379 | void exportICalendar(); |
381 | 380 | ||
382 | /** Export as vCalendar file */ | 381 | /** Export as vCalendar file */ |
383 | bool exportVCalendar( QString fn); | 382 | bool exportVCalendar( QString fn); |
384 | 383 | ||
385 | /** pop up a dialog to show an existing appointment. */ | 384 | /** pop up a dialog to show an existing appointment. */ |
386 | void appointment_show(); | 385 | void appointment_show(); |
387 | /** | 386 | /** |
388 | * pop up an Appointment Dialog to edit an existing appointment.Get | 387 | * pop up an Appointment Dialog to edit an existing appointment.Get |
389 | * information on the appointment from the list of unique IDs that is | 388 | * information on the appointment from the list of unique IDs that is |
390 | * currently in the View, called currIds. | 389 | * currently in the View, called currIds. |
391 | */ | 390 | */ |
392 | void appointment_edit(); | 391 | void appointment_edit(); |
393 | /** | 392 | /** |
394 | * pop up dialog confirming deletion of currently selected event in the | 393 | * pop up dialog confirming deletion of currently selected event in the |
395 | * View. | 394 | * View. |
396 | */ | 395 | */ |
397 | void appointment_delete(); | 396 | void appointment_delete(); |
398 | 397 | ||
399 | /** mails the currently selected event to a particular user as a vCalendar | 398 | /** mails the currently selected event to a particular user as a vCalendar |
400 | attachment. */ | 399 | attachment. */ |
401 | void action_mail(); | 400 | void action_mail(); |
402 | 401 | ||
403 | /* frees a subtodo from it's relation */ | 402 | /* frees a subtodo from it's relation */ |
404 | void todo_unsub( Todo * ); | 403 | void todo_unsub( Todo * ); |
405 | void todo_resub( Todo * parent, Todo * sub ); | 404 | void todo_resub( Todo * parent, Todo * sub ); |
406 | 405 | ||
407 | /** Take ownership of selected event. */ | 406 | /** Take ownership of selected event. */ |
408 | void takeOverEvent(); | 407 | void takeOverEvent(); |
409 | 408 | ||
410 | /** Take ownership of all events in calendar. */ | 409 | /** Take ownership of all events in calendar. */ |
411 | void takeOverCalendar(); | 410 | void takeOverCalendar(); |
412 | 411 | ||
413 | /** query whether or not the calendar is "dirty". */ | 412 | /** query whether or not the calendar is "dirty". */ |
414 | bool isModified(); | 413 | bool isModified(); |
415 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 414 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
416 | void setModified(bool modified=true); | 415 | void setModified(bool modified=true); |
417 | 416 | ||
418 | /** query if the calendar is read-only. */ | 417 | /** query if the calendar is read-only. */ |
419 | bool isReadOnly(); | 418 | bool isReadOnly(); |
420 | /** set state of calendar to read-only */ | 419 | /** set state of calendar to read-only */ |
421 | void setReadOnly(bool readOnly=true); | 420 | void setReadOnly(bool readOnly=true); |
422 | 421 | ||
423 | void eventUpdated(Incidence *); | 422 | void eventUpdated(Incidence *); |
424 | 423 | ||
425 | /* iTIP scheduling actions */ | 424 | /* iTIP scheduling actions */ |
426 | void schedule_publish(Incidence *incidence = 0); | 425 | void schedule_publish(Incidence *incidence = 0); |
427 | void schedule_request(Incidence *incidence = 0); | 426 | void schedule_request(Incidence *incidence = 0); |
428 | void schedule_refresh(Incidence *incidence = 0); | 427 | void schedule_refresh(Incidence *incidence = 0); |
429 | void schedule_cancel(Incidence *incidence = 0); | 428 | void schedule_cancel(Incidence *incidence = 0); |
430 | void schedule_add(Incidence *incidence = 0); | 429 | void schedule_add(Incidence *incidence = 0); |
431 | void schedule_reply(Incidence *incidence = 0); | 430 | void schedule_reply(Incidence *incidence = 0); |
432 | void schedule_counter(Incidence *incidence = 0); | 431 | void schedule_counter(Incidence *incidence = 0); |
433 | void schedule_declinecounter(Incidence *incidence = 0); | 432 | void schedule_declinecounter(Incidence *incidence = 0); |
434 | void schedule_publish_freebusy(int daysToPublish = 30); | 433 | void schedule_publish_freebusy(int daysToPublish = 30); |
435 | 434 | ||
436 | void openAddressbook(); | 435 | void openAddressbook(); |
437 | 436 | ||
438 | void editFilters(); | 437 | void editFilters(); |
439 | void toggleFilerEnabled(); | 438 | void toggleFilerEnabled(); |
440 | QPtrList<CalFilter> filters(); | 439 | QPtrList<CalFilter> filters(); |
441 | void toggleFilter(); | 440 | void toggleFilter(); |
442 | void showFilter(bool visible); | 441 | void showFilter(bool visible); |
443 | void updateFilter(); | 442 | void updateFilter(); |
444 | void filterEdited(); | 443 | void filterEdited(); |
445 | void selectFilter( int ); | 444 | void selectFilter( int ); |
446 | KOFilterView *filterView(); | 445 | KOFilterView *filterView(); |
447 | 446 | ||
448 | void showIntro(); | 447 | void showIntro(); |
449 | 448 | ||
450 | /** Move the curdatepient view date to today */ | 449 | /** Move the curdatepient view date to today */ |
451 | void goToday(); | 450 | void goToday(); |
452 | 451 | ||
453 | /** Move to the next date(s) in the current view */ | 452 | /** Move to the next date(s) in the current view */ |
454 | void goNext(); | 453 | void goNext(); |
455 | 454 | ||
456 | /** Move to the previous date(s) in the current view */ | 455 | /** Move to the previous date(s) in the current view */ |
457 | void goPrevious(); | 456 | void goPrevious(); |
458 | /** Move to the next date(s) in the current view */ | 457 | /** Move to the next date(s) in the current view */ |
459 | void goNextMonth(); | 458 | void goNextMonth(); |
460 | 459 | ||
461 | /** Move to the previous date(s) in the current view */ | 460 | /** Move to the previous date(s) in the current view */ |
462 | void goPreviousMonth(); | 461 | void goPreviousMonth(); |
463 | 462 | ||
464 | void toggleExpand(); | 463 | void toggleExpand(); |
465 | void toggleDateNavigatorWidget(); | 464 | void toggleDateNavigatorWidget(); |
466 | void toggleAllDaySize(); | 465 | void toggleAllDaySize(); |
467 | 466 | ||
468 | /** Look for new messages in the inbox */ | 467 | /** Look for new messages in the inbox */ |
469 | void lookForIncomingMessages(); | 468 | void lookForIncomingMessages(); |
470 | /** Look for new messages in the outbox */ | 469 | /** Look for new messages in the outbox */ |
471 | void lookForOutgoingMessages(); | 470 | void lookForOutgoingMessages(); |
472 | 471 | ||
473 | void processMainViewSelection( Incidence * ); | 472 | void processMainViewSelection( Incidence * ); |
474 | void processTodoListSelection( Incidence * ); | 473 | void processTodoListSelection( Incidence * ); |
475 | 474 | ||
476 | void processIncidenceSelection( Incidence * ); | 475 | void processIncidenceSelection( Incidence * ); |
477 | 476 | ||
478 | void purgeCompleted(); | 477 | void purgeCompleted(); |
479 | bool removeCompletedSubTodos( Todo* ); | 478 | bool removeCompletedSubTodos( Todo* ); |
480 | void slotCalendarChanged(); | 479 | void slotCalendarChanged(); |
481 | bool importBday(); | 480 | bool importBday(); |
482 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 481 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
483 | bool importQtopia( const QString &categoriesFile, | 482 | bool importQtopia( const QString &categoriesFile, |
484 | const QString &datebookFile, | 483 | const QString &datebookFile, |
485 | const QString &tasklistFile ); | 484 | const QString &tasklistFile ); |
486 | void syncExternal( int mode ); | 485 | void syncExternal( int mode ); |
487 | void slotSelectPickerDate( QDate ) ; | 486 | void slotSelectPickerDate( QDate ) ; |
488 | void showDatePicker() ; | 487 | void showDatePicker() ; |
489 | void showDatePickerPopup() ; | 488 | void showDatePickerPopup() ; |
490 | void moveIncidence(Incidence *) ; | 489 | void moveIncidence(Incidence *) ; |
491 | void beamIncidence(Incidence *) ; | 490 | void beamIncidence(Incidence *) ; |
492 | void beamCalendar() ; | 491 | void beamCalendar() ; |
493 | void beamFilteredCalendar() ; | 492 | void beamFilteredCalendar() ; |
494 | void beamIncidenceList(QPtrList<Incidence>) ; | 493 | void beamIncidenceList(QPtrList<Incidence>) ; |
495 | void manageCategories(); | 494 | void manageCategories(); |
496 | void editCategories(); | 495 | void editCategories(); |
497 | int addCategories(); | 496 | int addCategories(); |
498 | void removeCategories(); | 497 | void removeCategories(); |
499 | void setSyncDevice( QString ); | 498 | void setSyncDevice( QString ); |
500 | void setSyncName( QString ); | 499 | void setSyncName( QString ); |
501 | void showDay( QDate ); | 500 | void showDay( QDate ); |
502 | void undo_delete(); | 501 | void undo_delete(); |
503 | protected slots: | 502 | protected slots: |
504 | void resetFocus(); | 503 | void resetFocus(); |
505 | void scrollBarValue(int); | 504 | void scrollBarValue(int); |
506 | void slotViewerClosed(); | 505 | void slotViewerClosed(); |
507 | void timerAlarm(); | 506 | void timerAlarm(); |
508 | void suspendAlarm(); | 507 | void suspendAlarm(); |
509 | void beamDone( Ir *ir ); | 508 | void beamDone( Ir *ir ); |
510 | /** Select a view or adapt the current view to display the specified dates. */ | 509 | /** Select a view or adapt the current view to display the specified dates. */ |
511 | void showDates( const KCal::DateList & ); | 510 | void showDates( const KCal::DateList & ); |
512 | void selectWeekNum ( int ); | 511 | void selectWeekNum ( int ); |
513 | void checkConflictForEvent(); | 512 | void checkConflictForEvent(); |
514 | 513 | ||
515 | public: | 514 | public: |
516 | // show a standard warning | 515 | // show a standard warning |
517 | // returns KMsgBox::yesNoCancel() | 516 | // returns KMsgBox::yesNoCancel() |
518 | int msgCalModified(); | 517 | int msgCalModified(); |
519 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 518 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
520 | 519 | ||
521 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 520 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
522 | virtual void removeSyncInfo( QString syncProfile); | 521 | virtual void removeSyncInfo( QString syncProfile); |
523 | void setSyncManager(KSyncManager* manager); | 522 | void setSyncManager(KSyncManager* manager); |
524 | void setLoadedFileVersion(QDateTime); | 523 | void setLoadedFileVersion(QDateTime); |
525 | bool checkFileVersion(QString fn); | 524 | bool checkFileVersion(QString fn); |
526 | bool checkAllFileVersions(); | 525 | bool checkAllFileVersions(); |
527 | bool checkFileChanged(QString fn); | 526 | bool checkFileChanged(QString fn); |
528 | Event* getLastSyncEvent(); | 527 | Event* getLastSyncEvent(); |
529 | /** Adapt navigation units correpsonding to step size of navigation of the | 528 | /** Adapt navigation units correpsonding to step size of navigation of the |
530 | * current view. | 529 | * current view. |
531 | */ | 530 | */ |
532 | void adaptNavigationUnits(); | 531 | void adaptNavigationUnits(); |
533 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 532 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
534 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 533 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
535 | //Attendee* getYourAttendee(Event *event); | 534 | //Attendee* getYourAttendee(Event *event); |
536 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 535 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
537 | void setScrollBarStep(int val ); | 536 | void setScrollBarStep(int val ); |
538 | 537 | ||
539 | protected: | 538 | protected: |
540 | Event *mConflictingEvent; | 539 | Event *mConflictingEvent; |
541 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 540 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
542 | 541 | ||
543 | // returns KMsgBox::OKCandel() | 542 | // returns KMsgBox::OKCandel() |
544 | int msgItemDelete(const QString name); | 543 | int msgItemDelete(const QString name); |
545 | void showEventEditor(); | 544 | void showEventEditor(); |
546 | void showTodoEditor(); | 545 | void showTodoEditor(); |
547 | Todo *selectedTodo(); | 546 | Todo *selectedTodo(); |
548 | private: | 547 | private: |
549 | #ifdef DESKTOP_VERSION | 548 | #ifdef DESKTOP_VERSION |
550 | QScrollBar * mDateScrollBar; | 549 | QScrollBar * mDateScrollBar; |
551 | #endif | 550 | #endif |
552 | QDateTime mNextAlarmDateTime; | 551 | QDateTime mNextAlarmDateTime; |
553 | bool mViewerCallerIsSearchDialog; | 552 | bool mViewerCallerIsSearchDialog; |
554 | bool mBlockShowDates; | 553 | bool mBlockShowDates; |
555 | KSyncManager* mSyncManager; | 554 | KSyncManager* mSyncManager; |
556 | AlarmDialog * mAlarmDialog; | 555 | AlarmDialog * mAlarmDialog; |
557 | QString mAlarmNotification; | 556 | QString mAlarmNotification; |
558 | QString mSuspendAlarmNotification; | 557 | QString mSuspendAlarmNotification; |
559 | QTimer* mSuspendTimer; | 558 | QTimer* mSuspendTimer; |
560 | QTimer* mAlarmTimer; | 559 | QTimer* mAlarmTimer; |
561 | QTimer* mRecheckAlarmTimer; | 560 | QTimer* mRecheckAlarmTimer; |
562 | void computeAlarm( QString ); | 561 | void computeAlarm( QString ); |
563 | void startAlarm( QString, QString ); | 562 | void startAlarm( QString, QString ); |
564 | void setSyncEventsReadOnly(); | 563 | void setSyncEventsReadOnly(); |
565 | 564 | ||
566 | QDateTime loadedFileVersion; | 565 | QDateTime loadedFileVersion; |
567 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 566 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
568 | void checkExternalId( Incidence * inc ); | 567 | void checkExternalId( Incidence * inc ); |
569 | int mGlobalSyncMode; | 568 | int mGlobalSyncMode; |
570 | QString mCurrentSyncDevice; | 569 | QString mCurrentSyncDevice; |
571 | QString mCurrentSyncName; | 570 | QString mCurrentSyncName; |
572 | void init(); | 571 | void init(); |
573 | int mDatePickerMode; | 572 | int mDatePickerMode; |
574 | bool mFlagEditDescription; | 573 | bool mFlagEditDescription; |
575 | QDateTime mLastCalendarSync; | 574 | QDateTime mLastCalendarSync; |
576 | void createPrinter(); | 575 | void createPrinter(); |
577 | 576 | ||
578 | void calendarModified( bool, Calendar * ); | 577 | void calendarModified( bool, Calendar * ); |
579 | 578 | ||
580 | CalPrinter *mCalPrinter; | 579 | CalPrinter *mCalPrinter; |
581 | 580 | ||
582 | QSplitter *mPanner; | 581 | QSplitter *mPanner; |
583 | QSplitter *mLeftSplitter; | 582 | QSplitter *mLeftSplitter; |
584 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 583 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
585 | QWidgetStack *mRightFrame; | 584 | QWidgetStack *mRightFrame; |
586 | 585 | ||
587 | KDatePicker* mDatePicker; | 586 | KDatePicker* mDatePicker; |
588 | QVBox* mDateFrame; | 587 | QVBox* mDateFrame; |
589 | 588 | ||
590 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 589 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
591 | 590 | ||
592 | KOFilterView *mFilterView; | 591 | KOFilterView *mFilterView; |
593 | KOCalEditView *mCalEditView; | 592 | KOCalEditView *mCalEditView; |
594 | 593 | ||
595 | ResourceView *mResourceView; | 594 | ResourceView *mResourceView; |
596 | 595 | ||
597 | // calendar object for this viewing instance | 596 | // calendar object for this viewing instance |
598 | Calendar *mCalendar; | 597 | Calendar *mCalendar; |
599 | 598 | ||
600 | CalendarResourceManager *mResourceManager; | 599 | CalendarResourceManager *mResourceManager; |
601 | 600 | ||
602 | FileStorage *mStorage; | 601 | FileStorage *mStorage; |
603 | 602 | ||
604 | DateNavigator *mNavigator; | 603 | DateNavigator *mNavigator; |
605 | 604 | ||
606 | KOViewManager *mViewManager; | 605 | KOViewManager *mViewManager; |
607 | KODialogManager *mDialogManager; | 606 | KODialogManager *mDialogManager; |
608 | 607 | ||
609 | // Calendar filters | 608 | // Calendar filters |
610 | QPtrList<CalFilter> mFilters; | 609 | QPtrList<CalFilter> mFilters; |
611 | 610 | ||
612 | // various housekeeping variables. | 611 | // various housekeeping variables. |
613 | bool mModified; // flag indicating if calendar is modified | 612 | bool mModified; // flag indicating if calendar is modified |
614 | bool mReadOnly; // flag indicating if calendar is read-only | 613 | bool mReadOnly; // flag indicating if calendar is read-only |
615 | QDate mSaveSingleDate; | 614 | QDate mSaveSingleDate; |
616 | 615 | ||
617 | Incidence *mSelectedIncidence; | 616 | Incidence *mSelectedIncidence; |
618 | Incidence *mMoveIncidence; | 617 | Incidence *mMoveIncidence; |
619 | QDate mMoveIncidenceOldDate; | 618 | QDate mMoveIncidenceOldDate; |
620 | KOTodoView *mTodoList; | 619 | KOTodoView *mTodoList; |
621 | KOEventEditor * mEventEditor; | 620 | KOEventEditor * mEventEditor; |
622 | KOTodoEditor * mTodoEditor; | 621 | KOTodoEditor * mTodoEditor; |
623 | KOEventViewerDialog * mEventViewerDialog; | 622 | KOEventViewerDialog * mEventViewerDialog; |
624 | void keyPressEvent ( QKeyEvent *e) ; | 623 | void keyPressEvent ( QKeyEvent *e) ; |
625 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 624 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
626 | }; | 625 | }; |
627 | 626 | ||
628 | 627 | ||
629 | class CalendarViewVisitor : public Incidence::Visitor | 628 | class CalendarViewVisitor : public Incidence::Visitor |
630 | { | 629 | { |
631 | public: | 630 | public: |
632 | CalendarViewVisitor() : mView( 0 ) {} | 631 | CalendarViewVisitor() : mView( 0 ) {} |
633 | 632 | ||
634 | bool act( Incidence *incidence, CalendarView *view ) | 633 | bool act( Incidence *incidence, CalendarView *view ) |
635 | { | 634 | { |
636 | mView = view; | 635 | mView = view; |
637 | return incidence->accept( *this ); | 636 | return incidence->accept( *this ); |
638 | } | 637 | } |
639 | 638 | ||
640 | protected: | 639 | protected: |
641 | CalendarView *mView; | 640 | CalendarView *mView; |
642 | }; | 641 | }; |
643 | 642 | ||
644 | class ShowIncidenceVisitor : public CalendarViewVisitor | 643 | class ShowIncidenceVisitor : public CalendarViewVisitor |
645 | { | 644 | { |
646 | protected: | 645 | protected: |
647 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 646 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
648 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 647 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
649 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 648 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
650 | }; | 649 | }; |
651 | 650 | ||
652 | class EditIncidenceVisitor : public CalendarViewVisitor | 651 | class EditIncidenceVisitor : public CalendarViewVisitor |
653 | { | 652 | { |
654 | protected: | 653 | protected: |
655 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 654 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
656 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 655 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
657 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 656 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
658 | }; | 657 | }; |
659 | 658 | ||
660 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 659 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
661 | { | 660 | { |
662 | protected: | 661 | protected: |
663 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 662 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
664 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 663 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
665 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 664 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
666 | }; | 665 | }; |
667 | 666 | ||
668 | #endif | 667 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 21d5a35..279955f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,2634 +1,2655 @@ | |||
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/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qtopia/alarmserver.h> | 27 | #include <qtopia/alarmserver.h> |
28 | #include <qtopia/qcopenvelope_qws.h> | 28 | #include <qtopia/qcopenvelope_qws.h> |
29 | #include <unistd.h> // for sleep | 29 | #include <unistd.h> // for sleep |
30 | #else | 30 | #else |
31 | #include <qtoolbar.h> | 31 | #include <qtoolbar.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <resource.h> | 33 | //#include <resource.h> |
34 | 34 | ||
35 | #endif | 35 | #endif |
36 | #include <libkcal/calendarlocal.h> | 36 | #include <libkcal/calendarlocal.h> |
37 | #include <libkcal/todo.h> | 37 | #include <libkcal/todo.h> |
38 | #include <libkcal/phoneformat.h> | 38 | #include <libkcal/phoneformat.h> |
39 | #include <libkdepim/ksyncprofile.h> | 39 | #include <libkdepim/ksyncprofile.h> |
40 | #include <libkdepim/phoneaccess.h> | 40 | #include <libkdepim/phoneaccess.h> |
41 | #include <libkcal/kincidenceformatter.h> | 41 | #include <libkcal/kincidenceformatter.h> |
42 | #include <libkdepim/kpimglobalprefs.h> | 42 | #include <libkdepim/kpimglobalprefs.h> |
43 | 43 | ||
44 | #include "calendarview.h" | 44 | #include "calendarview.h" |
45 | #include "koviewmanager.h" | 45 | #include "koviewmanager.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | #include "koagendaview.h" | 47 | #include "koagendaview.h" |
48 | #include "kojournalview.h" | 48 | #include "kojournalview.h" |
49 | #include "koagenda.h" | 49 | #include "koagenda.h" |
50 | #include "kodialogmanager.h" | 50 | #include "kodialogmanager.h" |
51 | #include "kdialogbase.h" | 51 | #include "kdialogbase.h" |
52 | #include "kapplication.h" | 52 | #include "kapplication.h" |
53 | #include "kofilterview.h" | 53 | #include "kofilterview.h" |
54 | #include "kstandarddirs.h" | 54 | #include "kstandarddirs.h" |
55 | #include "koprefs.h" | 55 | #include "koprefs.h" |
56 | #include "kfiledialog.h" | 56 | #include "kfiledialog.h" |
57 | #include "koglobals.h" | 57 | #include "koglobals.h" |
58 | #include "kglobal.h" | 58 | #include "kglobal.h" |
59 | #include "ktoolbar.h" | 59 | #include "ktoolbar.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "externalapphandler.h" | 62 | #include "externalapphandler.h" |
63 | #include <kglobalsettings.h> | 63 | #include <kglobalsettings.h> |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | 75 | ||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
80 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | QPixmap* sgListViewCompletedPix[6]; | 131 | QPixmap* sgListViewCompletedPix[6]; |
132 | QPixmap* sgListViewJournalPix; | 132 | QPixmap* sgListViewJournalPix; |
133 | 133 | ||
134 | 134 | ||
135 | int globalFlagBlockStartup; | 135 | int globalFlagBlockStartup; |
136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : | 136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : |
137 | QMainWindow( parent, name ) | 137 | QMainWindow( parent, name ) |
138 | { | 138 | { |
139 | sgListViewCompletedPix[5] = &listviewPix; | 139 | sgListViewCompletedPix[5] = &listviewPix; |
140 | sgListViewCompletedPix[0] = &listviewPix0; | 140 | sgListViewCompletedPix[0] = &listviewPix0; |
141 | sgListViewCompletedPix[1] = &listviewPix20; | 141 | sgListViewCompletedPix[1] = &listviewPix20; |
142 | sgListViewCompletedPix[2] = &listviewPix40; | 142 | sgListViewCompletedPix[2] = &listviewPix40; |
143 | sgListViewCompletedPix[3] = &listviewPix60; | 143 | sgListViewCompletedPix[3] = &listviewPix60; |
144 | sgListViewCompletedPix[4] = &listviewPix80; | 144 | sgListViewCompletedPix[4] = &listviewPix80; |
145 | //int size = 12; | 145 | //int size = 12; |
146 | { | 146 | { |
147 | sgListViewCompletedPix[5]->resize( 11, 11 ); | 147 | sgListViewCompletedPix[5]->resize( 11, 11 ); |
148 | sgListViewCompletedPix[5]->fill( Qt::white ); | 148 | sgListViewCompletedPix[5]->fill( Qt::white ); |
149 | QPainter p ( sgListViewCompletedPix[5] ); | 149 | QPainter p ( sgListViewCompletedPix[5] ); |
150 | p.drawRect( 0,0,11,11); | 150 | p.drawRect( 0,0,11,11); |
151 | p.drawLine ( 2, 5, 4 , 7 ) ; | 151 | p.drawLine ( 2, 5, 4 , 7 ) ; |
152 | p.drawLine ( 4 , 7 , 8, 3) ; | 152 | p.drawLine ( 4 , 7 , 8, 3) ; |
153 | int iii = 0; | 153 | int iii = 0; |
154 | for ( iii = 0; iii < 5; ++iii ) { | 154 | for ( iii = 0; iii < 5; ++iii ) { |
155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); | 155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); |
156 | sgListViewCompletedPix[iii]->fill( Qt::white ); | 156 | sgListViewCompletedPix[iii]->fill( Qt::white ); |
157 | QPainter p ( sgListViewCompletedPix[iii] ); | 157 | QPainter p ( sgListViewCompletedPix[iii] ); |
158 | p.drawRect( 0,0,11,11); | 158 | p.drawRect( 0,0,11,11); |
159 | if ( iii ) | 159 | if ( iii ) |
160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
161 | } | 161 | } |
162 | sgListViewJournalPix = &journalPix; | 162 | sgListViewJournalPix = &journalPix; |
163 | sgListViewJournalPix->resize( 11, 11 ); | 163 | sgListViewJournalPix->resize( 11, 11 ); |
164 | sgListViewJournalPix->fill( Qt::white ); | 164 | sgListViewJournalPix->fill( Qt::white ); |
165 | { | 165 | { |
166 | QPainter p ( sgListViewJournalPix ); | 166 | QPainter p ( sgListViewJournalPix ); |
167 | p.drawRect( 0,0,11,11); | 167 | p.drawRect( 0,0,11,11); |
168 | p.drawLine( 2,3,5,3); | 168 | p.drawLine( 2,3,5,3); |
169 | p.drawLine( 2,5,8,5); | 169 | p.drawLine( 2,5,8,5); |
170 | p.drawLine( 2,7,6,7); | 170 | p.drawLine( 2,7,6,7); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | mClosed = false; | 173 | mClosed = false; |
174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
175 | QString confFile = locateLocal("config","korganizerrc"); | 175 | QString confFile = locateLocal("config","korganizerrc"); |
176 | QFileInfo finf ( confFile ); | 176 | QFileInfo finf ( confFile ); |
177 | bool showWarning = !finf.exists(); | 177 | bool showWarning = !finf.exists(); |
178 | setIcon(SmallIcon( "ko24" ) ); | 178 | setIcon(SmallIcon( "ko24" ) ); |
179 | mBlockAtStartup = true; | 179 | mBlockAtStartup = true; |
180 | mFlagKeyPressed = false; | 180 | mFlagKeyPressed = false; |
181 | setCaption("KO/Pi"); | 181 | setCaption("KO/Pi"); |
182 | KOPrefs *p = KOPrefs::instance(); | 182 | KOPrefs *p = KOPrefs::instance(); |
183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
184 | p->mCurrentDisplayedView = 0; | 184 | p->mCurrentDisplayedView = 0; |
185 | if ( p->mHourSize > 22 ) | 185 | if ( p->mHourSize > 22 ) |
186 | p->mHourSize = 22; | 186 | p->mHourSize = 22; |
187 | QMainWindow::ToolBarDock tbd; | 187 | QMainWindow::ToolBarDock tbd; |
188 | if ( p->mToolBarHor ) { | 188 | if ( p->mToolBarHor ) { |
189 | if ( p->mToolBarUp ) | 189 | if ( p->mToolBarUp ) |
190 | tbd = Bottom; | 190 | tbd = Bottom; |
191 | else | 191 | else |
192 | tbd = Top; | 192 | tbd = Top; |
193 | } | 193 | } |
194 | else { | 194 | else { |
195 | if ( p->mToolBarUp ) | 195 | if ( p->mToolBarUp ) |
196 | tbd = Right; | 196 | tbd = Right; |
197 | else | 197 | else |
198 | tbd = Left; | 198 | tbd = Left; |
199 | } | 199 | } |
200 | if ( KOPrefs::instance()->mUseAppColors ) | 200 | if ( KOPrefs::instance()->mUseAppColors ) |
201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
202 | globalFlagBlockStartup = 1; | 202 | globalFlagBlockStartup = 1; |
203 | iconToolBar = new QPEToolBar( this ); | 203 | iconToolBar = new QPEToolBar( this ); |
204 | addToolBar (iconToolBar , tbd ); | 204 | addToolBar (iconToolBar , tbd ); |
205 | 205 | ||
206 | #ifdef DESKTOP_VERSION | 206 | #ifdef DESKTOP_VERSION |
207 | if ( KOPrefs::instance()->mShowIconFilter ) | 207 | if ( KOPrefs::instance()->mShowIconFilter ) |
208 | #else | 208 | #else |
209 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | 209 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | { | 212 | { |
213 | if ( p->mToolBarHorF ) { | 213 | if ( p->mToolBarHorF ) { |
214 | if ( p->mToolBarUpF ) | 214 | if ( p->mToolBarUpF ) |
215 | tbd = Bottom; | 215 | tbd = Bottom; |
216 | else | 216 | else |
217 | tbd = Top; | 217 | tbd = Top; |
218 | } | 218 | } |
219 | else { | 219 | else { |
220 | if ( p->mToolBarUpF ) | 220 | if ( p->mToolBarUpF ) |
221 | tbd = Right; | 221 | tbd = Right; |
222 | else | 222 | else |
223 | tbd = Left; | 223 | tbd = Left; |
224 | } | 224 | } |
225 | filterToolBar = new QPEToolBar ( this ); | 225 | filterToolBar = new QPEToolBar ( this ); |
226 | filterMenubar = new KMenuBar( 0 ); | 226 | filterMenubar = new KMenuBar( 0 ); |
227 | QFontMetrics fm ( filterMenubar->font() ); | 227 | QFontMetrics fm ( filterMenubar->font() ); |
228 | 228 | ||
229 | filterPopupMenu = new QPopupMenu( this ); | 229 | filterPopupMenu = new QPopupMenu( this ); |
230 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 230 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
231 | QString addTest = "A"; | 231 | QString addTest = "A"; |
232 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 232 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
233 | #ifdef DESKTOP_VERSION | 233 | #ifdef DESKTOP_VERSION |
234 | addTest = "AAABBBCCCx"; | 234 | addTest = "AAABBBCCCx"; |
235 | #else | 235 | #else |
236 | addTest = "AAx"; | 236 | addTest = "AAx"; |
237 | #endif | 237 | #endif |
238 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 238 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
239 | addToolBar (filterToolBar , tbd ); | 239 | addToolBar (filterToolBar , tbd ); |
240 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 240 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
241 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 241 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
242 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 242 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
243 | filterToolBar->hide(); | 243 | filterToolBar->hide(); |
244 | } else { | 244 | } else { |
245 | filterToolBar = 0; | 245 | filterToolBar = 0; |
246 | filterMenubar = 0; | 246 | filterMenubar = 0; |
247 | filterPopupMenu = 0; | 247 | filterPopupMenu = 0; |
248 | } | 248 | } |
249 | if ( p->mShowIconOnetoolbar ) { | 249 | if ( p->mShowIconOnetoolbar ) { |
250 | viewToolBar = iconToolBar ; | 250 | viewToolBar = iconToolBar ; |
251 | navigatorToolBar = iconToolBar ; | 251 | navigatorToolBar = iconToolBar ; |
252 | } else { | 252 | } else { |
253 | #ifndef DESKTOP_VERSION | 253 | #ifndef DESKTOP_VERSION |
254 | setToolBarsMovable( false ); | 254 | setToolBarsMovable( false ); |
255 | #endif | 255 | #endif |
256 | if ( p->mToolBarHorV ) { | 256 | if ( p->mToolBarHorV ) { |
257 | if ( p->mToolBarUpV ) | 257 | if ( p->mToolBarUpV ) |
258 | tbd = Bottom; | 258 | tbd = Bottom; |
259 | else | 259 | else |
260 | tbd = Top; | 260 | tbd = Top; |
261 | } | 261 | } |
262 | else { | 262 | else { |
263 | if ( p->mToolBarUpV ) | 263 | if ( p->mToolBarUpV ) |
264 | tbd = Right; | 264 | tbd = Right; |
265 | else | 265 | else |
266 | tbd = Left; | 266 | tbd = Left; |
267 | } | 267 | } |
268 | viewToolBar = new QPEToolBar( this ); | 268 | viewToolBar = new QPEToolBar( this ); |
269 | addToolBar (viewToolBar , tbd ); | 269 | addToolBar (viewToolBar , tbd ); |
270 | if ( p->mToolBarHorN ) { | 270 | if ( p->mToolBarHorN ) { |
271 | if ( p->mToolBarUpN ) | 271 | if ( p->mToolBarUpN ) |
272 | tbd = Bottom; | 272 | tbd = Bottom; |
273 | else | 273 | else |
274 | tbd = Top; | 274 | tbd = Top; |
275 | } | 275 | } |
276 | else { | 276 | else { |
277 | if ( p->mToolBarUpN ) | 277 | if ( p->mToolBarUpN ) |
278 | tbd = Right; | 278 | tbd = Right; |
279 | else | 279 | else |
280 | tbd = Left; | 280 | tbd = Left; |
281 | } | 281 | } |
282 | navigatorToolBar = new QPEToolBar( this ); | 282 | navigatorToolBar = new QPEToolBar( this ); |
283 | addToolBar (navigatorToolBar , tbd ); | 283 | addToolBar (navigatorToolBar , tbd ); |
284 | } | 284 | } |
285 | 285 | ||
286 | 286 | ||
287 | 287 | ||
288 | mCalendarModifiedFlag = false; | 288 | mCalendarModifiedFlag = false; |
289 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 289 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
290 | splash->setAlignment ( AlignCenter ); | 290 | splash->setAlignment ( AlignCenter ); |
291 | setCentralWidget( splash ); | 291 | setCentralWidget( splash ); |
292 | #ifndef DESKTOP_VERSION | 292 | #ifndef DESKTOP_VERSION |
293 | showMaximized(); | 293 | showMaximized(); |
294 | #endif | 294 | #endif |
295 | 295 | ||
296 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 296 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
297 | setDefaultPreferences(); | 297 | setDefaultPreferences(); |
298 | mCalendar = new CalendarLocal(); | 298 | mCalendar = new CalendarLocal(); |
299 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 299 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
300 | mView->hide(); | 300 | mView->hide(); |
301 | //mView->resize(splash->size() ); | 301 | //mView->resize(splash->size() ); |
302 | initActions(); | 302 | initActions(); |
303 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 303 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
304 | mSyncManager->setBlockSave(false); | 304 | mSyncManager->setBlockSave(false); |
305 | mView->setSyncManager(mSyncManager); | 305 | mView->setSyncManager(mSyncManager); |
306 | #ifndef DESKTOP_VERSION | 306 | #ifndef DESKTOP_VERSION |
307 | iconToolBar->show(); | 307 | iconToolBar->show(); |
308 | qApp->processEvents(); | 308 | qApp->processEvents(); |
309 | #endif | 309 | #endif |
310 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 310 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
311 | int vh = height() ; | 311 | int vh = height() ; |
312 | int vw = width(); | 312 | int vw = width(); |
313 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 313 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
314 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 314 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
315 | vh -= iconToolBar->height(); | 315 | vh -= iconToolBar->height(); |
316 | } else { | 316 | } else { |
317 | vw -= iconToolBar->height(); | 317 | vw -= iconToolBar->height(); |
318 | } | 318 | } |
319 | //mView->setMaximumSize( splash->size() ); | 319 | //mView->setMaximumSize( splash->size() ); |
320 | //mView->resize( splash->size() ); | 320 | //mView->resize( splash->size() ); |
321 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 321 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
322 | mView->readSettings(); | 322 | mView->readSettings(); |
323 | bool newFile = false; | 323 | bool newFile = false; |
324 | if( !QFile::exists( defaultFileName() ) ) { | 324 | if( !QFile::exists( defaultFileName() ) ) { |
325 | QFileInfo finfo ( defaultFileName() ); | 325 | QFileInfo finfo ( defaultFileName() ); |
326 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 326 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
327 | 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"; | 327 | 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"; |
328 | finfo.setFile( oldFile ); | 328 | finfo.setFile( oldFile ); |
329 | if (finfo.exists() ) { | 329 | if (finfo.exists() ) { |
330 | KMessageBox::information( this, message); | 330 | KMessageBox::information( this, message); |
331 | mView->openCalendar( oldFile ); | 331 | mView->openCalendar( oldFile ); |
332 | qApp->processEvents(); | 332 | qApp->processEvents(); |
333 | } else { | 333 | } else { |
334 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 334 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
335 | finfo.setFile( oldFile ); | 335 | finfo.setFile( oldFile ); |
336 | if (finfo.exists() ) { | 336 | if (finfo.exists() ) { |
337 | KMessageBox::information( this, message); | 337 | KMessageBox::information( this, message); |
338 | mView->openCalendar( oldFile ); | 338 | mView->openCalendar( oldFile ); |
339 | qApp->processEvents(); | 339 | qApp->processEvents(); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | mView->saveCalendar( defaultFileName() ); | 342 | mView->saveCalendar( defaultFileName() ); |
343 | newFile = true; | 343 | newFile = true; |
344 | } | 344 | } |
345 | 345 | ||
346 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 346 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
347 | mView->loadCalendars(); | 347 | mView->loadCalendars(); |
348 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 348 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
349 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 349 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
350 | 350 | ||
351 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 351 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
352 | KOPrefs::instance()->setAllDefaults(); | 352 | KOPrefs::instance()->setAllDefaults(); |
353 | } | 353 | } |
354 | processIncidenceSelection( 0 ); | 354 | processIncidenceSelection( 0 ); |
355 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 355 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
356 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 356 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
357 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 357 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
358 | SLOT( slotModifiedChanged( bool ) ) ); | 358 | SLOT( slotModifiedChanged( bool ) ) ); |
359 | 359 | ||
360 | 360 | ||
361 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 361 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
362 | SLOT( disableBR(bool) ) ); | 362 | SLOT( disableBR(bool) ) ); |
363 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 363 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
364 | mView->setModified( false ); | 364 | mView->setModified( false ); |
365 | mBlockAtStartup = false; | 365 | mBlockAtStartup = false; |
366 | mView->setModified( false ); | 366 | mView->setModified( false ); |
367 | setCentralWidget( mView ); | 367 | setCentralWidget( mView ); |
368 | globalFlagBlockStartup = 0; | 368 | globalFlagBlockStartup = 0; |
369 | mView->show(); | 369 | mView->show(); |
370 | delete splash; | 370 | delete splash; |
371 | if ( newFile ) | 371 | if ( newFile ) |
372 | mView->updateConfig(); | 372 | mView->updateConfig(); |
373 | // qApp->processEvents(); | 373 | // qApp->processEvents(); |
374 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 374 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
375 | //fillSyncMenu(); | 375 | //fillSyncMenu(); |
376 | 376 | ||
377 | 377 | ||
378 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 378 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
379 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 379 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
380 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 380 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
381 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 381 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
382 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 382 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
383 | mSyncManager->setDefaultFileName( sentSyncFile()); | 383 | mSyncManager->setDefaultFileName( sentSyncFile()); |
384 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 384 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
385 | mSyncManager->fillSyncMenu(); | 385 | mSyncManager->fillSyncMenu(); |
386 | 386 | ||
387 | 387 | ||
388 | 388 | ||
389 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 389 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
390 | if ( showWarning ) { | 390 | if ( showWarning ) { |
391 | KMessageBox::information( this, | 391 | KMessageBox::information( this, |
392 | "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"); | 392 | "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"); |
393 | qApp->processEvents(); | 393 | qApp->processEvents(); |
394 | mView->dialogManager()->showSyncOptions(); | 394 | mView->dialogManager()->showSyncOptions(); |
395 | } | 395 | } |
396 | 396 | ||
397 | //US listen for result adressed from Ka/Pi | 397 | //US listen for result adressed from Ka/Pi |
398 | #ifndef DESKTOP_VERSION | 398 | #ifndef DESKTOP_VERSION |
399 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 399 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
400 | #endif | 400 | #endif |
401 | #ifndef DESKTOP_VERSION | 401 | #ifndef DESKTOP_VERSION |
402 | infrared = 0; | 402 | infrared = 0; |
403 | #endif | 403 | #endif |
404 | updateFilterToolbar(); | 404 | updateFilterToolbar(); |
405 | updateWeek( mView->startDate() ); | 405 | updateWeek( mView->startDate() ); |
406 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 406 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
407 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 407 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
408 | mBRdisabled = false; | 408 | mBRdisabled = false; |
409 | //toggleBeamReceive(); | 409 | //toggleBeamReceive(); |
410 | 410 | ||
411 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 411 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
412 | } | 412 | } |
413 | MainWindow::~MainWindow() | 413 | MainWindow::~MainWindow() |
414 | { | 414 | { |
415 | //qDebug("MainWindow::~MainWindow() "); | 415 | //qDebug("MainWindow::~MainWindow() "); |
416 | //save toolbar location | 416 | //save toolbar location |
417 | delete mCalendar; | 417 | delete mCalendar; |
418 | delete mSyncManager; | 418 | delete mSyncManager; |
419 | #ifndef DESKTOP_VERSION | 419 | #ifndef DESKTOP_VERSION |
420 | if ( infrared ) | 420 | if ( infrared ) |
421 | delete infrared; | 421 | delete infrared; |
422 | #endif | 422 | #endif |
423 | 423 | ||
424 | 424 | ||
425 | } | 425 | } |
426 | 426 | void MainWindow::slotResetFocus() | |
427 | { | ||
428 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | ||
429 | mFocusLoop = 3; | ||
430 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | ||
431 | } | ||
432 | void MainWindow::slotResetFocusLoop() | ||
433 | { | ||
434 | --mFocusLoop; | ||
435 | QWidget* fw = mView->viewManager()->currentView(); | ||
436 | if ( fw ) { | ||
437 | //qDebug("loop "); | ||
438 | fw->setFocus(); | ||
439 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | ||
440 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | ||
441 | } | ||
442 | |||
443 | } | ||
427 | void MainWindow::disableBR(bool b) | 444 | void MainWindow::disableBR(bool b) |
428 | { | 445 | { |
429 | #ifndef DESKTOP_VERSION | 446 | #ifndef DESKTOP_VERSION |
430 | if ( b ) { | 447 | if ( b ) { |
431 | if ( infrared ) { | 448 | if ( infrared ) { |
432 | toggleBeamReceive(); | 449 | toggleBeamReceive(); |
433 | mBRdisabled = true; | 450 | mBRdisabled = true; |
434 | } | 451 | } |
435 | mBRdisabled = true; | 452 | mBRdisabled = true; |
436 | } else { | 453 | } else { |
437 | if ( mBRdisabled ) { | 454 | if ( mBRdisabled ) { |
438 | mBRdisabled = false; | 455 | mBRdisabled = false; |
439 | //makes no sense,because other cal ap is probably running | 456 | //makes no sense,because other cal ap is probably running |
440 | // toggleBeamReceive(); | 457 | // toggleBeamReceive(); |
441 | } | 458 | } |
442 | } | 459 | } |
443 | #endif | 460 | #endif |
444 | 461 | ||
445 | } | 462 | } |
446 | bool MainWindow::beamReceiveEnabled() | 463 | bool MainWindow::beamReceiveEnabled() |
447 | { | 464 | { |
448 | #ifndef DESKTOP_VERSION | 465 | #ifndef DESKTOP_VERSION |
449 | return ( infrared != 0 ); | 466 | return ( infrared != 0 ); |
450 | #endif | 467 | #endif |
451 | return false; | 468 | return false; |
452 | } | 469 | } |
453 | 470 | ||
454 | void MainWindow::toggleBeamReceive() | 471 | void MainWindow::toggleBeamReceive() |
455 | { | 472 | { |
456 | if ( mBRdisabled ) | 473 | if ( mBRdisabled ) |
457 | return; | 474 | return; |
458 | #ifndef DESKTOP_VERSION | 475 | #ifndef DESKTOP_VERSION |
459 | if ( infrared ) { | 476 | if ( infrared ) { |
460 | qDebug("KO: Disable BeamReceive "); | 477 | qDebug("KO: Disable BeamReceive "); |
461 | delete infrared; | 478 | delete infrared; |
462 | infrared = 0; | 479 | infrared = 0; |
463 | brAction->setOn(false); | 480 | brAction->setOn(false); |
464 | return; | 481 | return; |
465 | } | 482 | } |
466 | qDebug("KO: Enable BeamReceive "); | 483 | qDebug("KO: Enable BeamReceive "); |
467 | brAction->setOn(true); | 484 | brAction->setOn(true); |
468 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 485 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
469 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 486 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
470 | #endif | 487 | #endif |
471 | } | 488 | } |
472 | void MainWindow::showMaximized () | 489 | void MainWindow::showMaximized () |
473 | { | 490 | { |
474 | #ifndef DESKTOP_VERSION | 491 | #ifndef DESKTOP_VERSION |
475 | if ( ! globalFlagBlockStartup ) | 492 | if ( ! globalFlagBlockStartup ) |
476 | if ( mClosed ) | 493 | if ( mClosed ) |
477 | mView->goToday(); | 494 | mView->goToday(); |
478 | #endif | 495 | #endif |
479 | QWidget::showMaximized () ; | 496 | QWidget::showMaximized () ; |
480 | mClosed = false; | 497 | mClosed = false; |
481 | } | 498 | } |
482 | void MainWindow::closeEvent( QCloseEvent* ce ) | 499 | void MainWindow::closeEvent( QCloseEvent* ce ) |
483 | { | 500 | { |
484 | 501 | ||
485 | 502 | ||
486 | 503 | ||
487 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 504 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
488 | saveOnClose(); | 505 | saveOnClose(); |
489 | mClosed = true; | 506 | mClosed = true; |
490 | ce->accept(); | 507 | ce->accept(); |
491 | return; | 508 | return; |
492 | 509 | ||
493 | } | 510 | } |
494 | 511 | ||
495 | switch( QMessageBox::information( this, "KO/Pi", | 512 | switch( QMessageBox::information( this, "KO/Pi", |
496 | i18n("Do you really want\nto close KO/Pi?"), | 513 | i18n("Do you really want\nto close KO/Pi?"), |
497 | i18n("Close"), i18n("No"), | 514 | i18n("Close"), i18n("No"), |
498 | 0, 0 ) ) { | 515 | 0, 0 ) ) { |
499 | case 0: | 516 | case 0: |
500 | saveOnClose(); | 517 | saveOnClose(); |
501 | mClosed = true; | 518 | mClosed = true; |
502 | ce->accept(); | 519 | ce->accept(); |
503 | break; | 520 | break; |
504 | case 1: | 521 | case 1: |
505 | ce->ignore(); | 522 | ce->ignore(); |
506 | break; | 523 | break; |
507 | case 2: | 524 | case 2: |
508 | 525 | ||
509 | default: | 526 | default: |
510 | break; | 527 | break; |
511 | } | 528 | } |
512 | 529 | ||
513 | 530 | ||
514 | } | 531 | } |
515 | 532 | ||
516 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 533 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
517 | { | 534 | { |
518 | QDataStream stream( data, IO_ReadOnly ); | 535 | QDataStream stream( data, IO_ReadOnly ); |
519 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 536 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
520 | //QString datamess; | 537 | //QString datamess; |
521 | //qDebug("message "); | 538 | //qDebug("message "); |
522 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 539 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
523 | 540 | ||
524 | if ( cmsg == "setDocument(QString)" ) { | 541 | if ( cmsg == "setDocument(QString)" ) { |
525 | QDataStream stream( data, IO_ReadOnly ); | 542 | QDataStream stream( data, IO_ReadOnly ); |
526 | QString fileName; | 543 | QString fileName; |
527 | stream >> fileName; | 544 | stream >> fileName; |
528 | //qDebug("filename %s ", fileName.latin1()); | 545 | //qDebug("filename %s ", fileName.latin1()); |
529 | showMaximized(); | 546 | showMaximized(); |
530 | raise(); | 547 | raise(); |
531 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 548 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
532 | mSyncManager->slotSyncMenu( 1002 ); | 549 | mSyncManager->slotSyncMenu( 1002 ); |
533 | return; | 550 | return; |
534 | } | 551 | } |
535 | 552 | ||
536 | if ( cmsg == "-writeFile" ) { | 553 | if ( cmsg == "-writeFile" ) { |
537 | // I made from the "-writeFile" an "-writeAlarm" | 554 | // I made from the "-writeFile" an "-writeAlarm" |
538 | mView->viewManager()->showWhatsNextView(); | 555 | mView->viewManager()->showWhatsNextView(); |
539 | mCalendar->checkAlarmForIncidence( 0, true); | 556 | mCalendar->checkAlarmForIncidence( 0, true); |
540 | showMaximized(); | 557 | showMaximized(); |
541 | raise(); | 558 | raise(); |
542 | return; | 559 | return; |
543 | 560 | ||
544 | } | 561 | } |
545 | if ( cmsg == "-writeFileSilent" ) { | 562 | if ( cmsg == "-writeFileSilent" ) { |
546 | // I made from the "-writeFile" an "-writeAlarm" | 563 | // I made from the "-writeFile" an "-writeAlarm" |
547 | // mView->viewManager()->showWhatsNextView(); | 564 | // mView->viewManager()->showWhatsNextView(); |
548 | mCalendar->checkAlarmForIncidence( 0, true); | 565 | mCalendar->checkAlarmForIncidence( 0, true); |
549 | //showMaximized(); | 566 | //showMaximized(); |
550 | //raise(); | 567 | //raise(); |
551 | hide(); | 568 | hide(); |
552 | return; | 569 | return; |
553 | } | 570 | } |
554 | if ( cmsg == "-newCountdown" ) { | 571 | if ( cmsg == "-newCountdown" ) { |
555 | qDebug("newCountdown "); | 572 | qDebug("newCountdown "); |
556 | 573 | ||
557 | } | 574 | } |
558 | QString msg ; | 575 | QString msg ; |
559 | QString allmsg = cmsg; | 576 | QString allmsg = cmsg; |
560 | while ( allmsg.length() > 0 ) { | 577 | while ( allmsg.length() > 0 ) { |
561 | int nextC = allmsg.find( "-", 1 ); | 578 | int nextC = allmsg.find( "-", 1 ); |
562 | if ( nextC == -1 ) { | 579 | if ( nextC == -1 ) { |
563 | msg = allmsg; | 580 | msg = allmsg; |
564 | allmsg = ""; | 581 | allmsg = ""; |
565 | } else{ | 582 | } else{ |
566 | msg = allmsg.left( nextC ); | 583 | msg = allmsg.left( nextC ); |
567 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 584 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
568 | } | 585 | } |
569 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 586 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
570 | if ( msg == "-newEvent" ) { | 587 | if ( msg == "-newEvent" ) { |
571 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); | 588 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); |
572 | } | 589 | } |
573 | if ( msg == "-newTodo" ) { | 590 | if ( msg == "-newTodo" ) { |
574 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); | 591 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); |
575 | } | 592 | } |
576 | if ( msg == "-showWN" ) { | 593 | if ( msg == "-showWN" ) { |
577 | mView->viewManager()->showWhatsNextView(); | 594 | mView->viewManager()->showWhatsNextView(); |
578 | } | 595 | } |
579 | if ( msg == "-showTodo" ) { | 596 | if ( msg == "-showTodo" ) { |
580 | mView->viewManager()->showTodoView(); | 597 | mView->viewManager()->showTodoView(); |
581 | } | 598 | } |
582 | if ( msg == "-showList" ) { | 599 | if ( msg == "-showList" ) { |
583 | mView->viewManager()->showListView(); | 600 | mView->viewManager()->showListView(); |
584 | } | 601 | } |
585 | else if ( msg == "-showDay" ) { | 602 | else if ( msg == "-showDay" ) { |
586 | mView->viewManager()->showDayView(); | 603 | mView->viewManager()->showDayView(); |
587 | } | 604 | } |
588 | else if ( msg == "-showWWeek" ) { | 605 | else if ( msg == "-showWWeek" ) { |
589 | mView->viewManager()->showWorkWeekView(); | 606 | mView->viewManager()->showWorkWeekView(); |
590 | } | 607 | } |
591 | else if ( msg == "-ringSync" ) { | 608 | else if ( msg == "-ringSync" ) { |
592 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); | 609 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); |
593 | } | 610 | } |
594 | else if ( msg == "-showWeek" ) { | 611 | else if ( msg == "-showWeek" ) { |
595 | mView->viewManager()->showWeekView(); | 612 | mView->viewManager()->showWeekView(); |
596 | } | 613 | } |
597 | else if ( msg == "-showTodo" ) { | 614 | else if ( msg == "-showTodo" ) { |
598 | mView->viewManager()->showTodoView(); | 615 | mView->viewManager()->showTodoView(); |
599 | } | 616 | } |
600 | else if ( msg == "-showJournal" ) { | 617 | else if ( msg == "-showJournal" ) { |
601 | mView->dateNavigator()->selectDates( 1 ); | 618 | mView->dateNavigator()->selectDates( 1 ); |
602 | mView->dateNavigator()->selectToday(); | 619 | mView->dateNavigator()->selectToday(); |
603 | mView->viewManager()->showJournalView(); | 620 | mView->viewManager()->showJournalView(); |
604 | } | 621 | } |
605 | else if ( msg == "-showKO" ) { | 622 | else if ( msg == "-showKO" ) { |
606 | mView->viewManager()->showNextXView(); | 623 | mView->viewManager()->showNextXView(); |
607 | } | 624 | } |
608 | else if ( msg == "-showWNext" ) { | 625 | else if ( msg == "-showWNext" ) { |
609 | mView->viewManager()->showWhatsNextView(); | 626 | mView->viewManager()->showWhatsNextView(); |
610 | } | 627 | } |
611 | else if ( msg == "nextView()" ) { | 628 | else if ( msg == "nextView()" ) { |
612 | mView->viewManager()->showNextView(); | 629 | mView->viewManager()->showNextView(); |
613 | } | 630 | } |
614 | else if ( msg == "-showNextXView" ) { | 631 | else if ( msg == "-showNextXView" ) { |
615 | mView->viewManager()->showNextXView(); | 632 | mView->viewManager()->showNextXView(); |
616 | } | 633 | } |
617 | 634 | ||
618 | 635 | ||
619 | } | 636 | } |
620 | 637 | ||
621 | showMaximized(); | 638 | showMaximized(); |
622 | raise(); | 639 | raise(); |
623 | } | 640 | } |
624 | void MainWindow::startMultiSync() | 641 | void MainWindow::startMultiSync() |
625 | { | 642 | { |
626 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 643 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
627 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), | 644 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), |
628 | question, | 645 | question, |
629 | i18n("Yes"), i18n("No"), | 646 | i18n("Yes"), i18n("No"), |
630 | 0, 0 ) != 0 ) { | 647 | 0, 0 ) != 0 ) { |
631 | setCaption(i18n("Aborted! Nothing synced!")); | 648 | setCaption(i18n("Aborted! Nothing synced!")); |
632 | return; | 649 | return; |
633 | } | 650 | } |
634 | mSyncManager->multiSync( false ); | 651 | mSyncManager->multiSync( false ); |
635 | #ifndef DESKTOP_VERSION | 652 | #ifndef DESKTOP_VERSION |
636 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); | 653 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); |
637 | #endif | 654 | #endif |
638 | } | 655 | } |
639 | QPixmap MainWindow::loadPixmap( QString name ) | 656 | QPixmap MainWindow::loadPixmap( QString name ) |
640 | { | 657 | { |
641 | return SmallIcon( name ); | 658 | return SmallIcon( name ); |
642 | 659 | ||
643 | } | 660 | } |
644 | void MainWindow::setUsesBigPixmaps ( bool b ) | 661 | void MainWindow::setUsesBigPixmaps ( bool b ) |
645 | { | 662 | { |
646 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 663 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
647 | if ( b ) | 664 | if ( b ) |
648 | qDebug("KO: BigPixmaps are not supported "); | 665 | qDebug("KO: BigPixmaps are not supported "); |
649 | } | 666 | } |
650 | void MainWindow::initActions() | 667 | void MainWindow::initActions() |
651 | { | 668 | { |
652 | //KOPrefs::instance()->mShowFullMenu | 669 | //KOPrefs::instance()->mShowFullMenu |
653 | iconToolBar->clear(); | 670 | iconToolBar->clear(); |
654 | KOPrefs *p = KOPrefs::instance(); | 671 | KOPrefs *p = KOPrefs::instance(); |
655 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 672 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
656 | 673 | ||
657 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 674 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
658 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 675 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
659 | mCurrentItemMenu = new QPopupMenu ( this ); | 676 | mCurrentItemMenu = new QPopupMenu ( this ); |
660 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); | 677 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); |
661 | QPopupMenu *importMenu = new QPopupMenu( this ); | 678 | QPopupMenu *importMenu = new QPopupMenu( this ); |
662 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 679 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
663 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 680 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
664 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 681 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
665 | selectFilterMenu = new QPopupMenu( this ); | 682 | selectFilterMenu = new QPopupMenu( this ); |
666 | selectFilterMenu->setCheckable( true ); | 683 | selectFilterMenu->setCheckable( true ); |
667 | syncMenu = new QPopupMenu( this ); | 684 | syncMenu = new QPopupMenu( this ); |
668 | configureAgendaMenu = new QPopupMenu( this ); | 685 | configureAgendaMenu = new QPopupMenu( this ); |
669 | configureToolBarMenu = new QPopupMenu( this ); | 686 | configureToolBarMenu = new QPopupMenu( this ); |
670 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 687 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
671 | QIconSet icon; | 688 | QIconSet icon; |
672 | int pixWid = 22, pixHei = 22; | 689 | int pixWid = 22, pixHei = 22; |
673 | QString pathString = ""; | 690 | QString pathString = ""; |
674 | if ( !p->mToolBarMiniIcons ) { | 691 | if ( !p->mToolBarMiniIcons ) { |
675 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 692 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
676 | pathString += "icons16/"; | 693 | pathString += "icons16/"; |
677 | pixWid = 18; pixHei = 16; | 694 | pixWid = 18; pixHei = 16; |
678 | } | 695 | } |
679 | } else { | 696 | } else { |
680 | pathString += "iconsmini/"; | 697 | pathString += "iconsmini/"; |
681 | pixWid = 18; pixHei = 16; | 698 | pixWid = 18; pixHei = 16; |
682 | } | 699 | } |
683 | KMenuBar *menuBar1; | 700 | |
684 | if ( KOPrefs::instance()->mShowFullMenu ) { | 701 | if ( KOPrefs::instance()->mShowFullMenu ) { |
685 | menuBar1 = new KMenuBar( this );//menuBar(); | 702 | menuBar1 = new KMenuBar( this );//menuBar(); |
703 | //setMenuBar( menuBar1 ); | ||
704 | menuBar1->show(); | ||
686 | menuBar1->insertItem( i18n("File"), importMenu ); | 705 | menuBar1->insertItem( i18n("File"), importMenu ); |
687 | menuBar1->insertItem( i18n("View"), viewMenu ); | 706 | menuBar1->insertItem( i18n("View"), viewMenu ); |
688 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); | 707 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); |
689 | menuBar1->insertItem( i18n("Action"), actionMenu ); | 708 | menuBar1->insertItem( i18n("Action"), actionMenu ); |
690 | #ifdef DESKTOP_VERSION | 709 | #ifdef DESKTOP_VERSION |
691 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 710 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
692 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 711 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
693 | #else | 712 | #else |
694 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 713 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
695 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 714 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
696 | #endif | 715 | #endif |
697 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 716 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
698 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 717 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
699 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 718 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
700 | } else { | 719 | } else { |
701 | menuBar1 = new KMenuBar( iconToolBar ); | 720 | menuBar1 = new KMenuBar( iconToolBar ); |
702 | QPopupMenu *menuBar = new QPopupMenu( this ); | 721 | QPopupMenu *menuBar = new QPopupMenu( this ); |
703 | icon = loadPixmap( pathString + "z_menu" ); | 722 | icon = loadPixmap( pathString + "z_menu" ); |
704 | menuBar1->insertItem( icon.pixmap(), menuBar); | 723 | menuBar1->insertItem( icon.pixmap(), menuBar); |
705 | //menuBar1->insertItem( i18n("ME"), menuBar); | 724 | //menuBar1->insertItem( i18n("ME"), menuBar); |
706 | menuBar->insertItem( i18n("File"), importMenu ); | 725 | menuBar->insertItem( i18n("File"), importMenu ); |
707 | menuBar->insertItem( i18n("View"), viewMenu ); | 726 | menuBar->insertItem( i18n("View"), viewMenu ); |
708 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); | 727 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); |
709 | menuBar->insertItem( i18n("Action"), actionMenu ); | 728 | menuBar->insertItem( i18n("Action"), actionMenu ); |
710 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 729 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
711 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 730 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
712 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 731 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
713 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 732 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
714 | menuBar->insertItem( i18n("Help"), helpMenu ); | 733 | menuBar->insertItem( i18n("Help"), helpMenu ); |
715 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 734 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
716 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 735 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
736 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); | ||
717 | } | 737 | } |
718 | connect ( menuBar1, SIGNAL( lostFocus () ), mView, SLOT ( slotResetFocus() ) ); | 738 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
739 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | ||
719 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 740 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
720 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 741 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
721 | 742 | ||
722 | 743 | ||
723 | mWeekBgColor = iconToolBar->backgroundColor(); | 744 | mWeekBgColor = iconToolBar->backgroundColor(); |
724 | mWeekPixmap.resize( pixWid , pixHei ); | 745 | mWeekPixmap.resize( pixWid , pixHei ); |
725 | mWeekPixmap.fill( mWeekBgColor ); | 746 | mWeekPixmap.fill( mWeekBgColor ); |
726 | icon = mWeekPixmap; | 747 | icon = mWeekPixmap; |
727 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 748 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
728 | if ( p-> mShowIconWeekNum ) | 749 | if ( p-> mShowIconWeekNum ) |
729 | mWeekAction->addTo( iconToolBar ); | 750 | mWeekAction->addTo( iconToolBar ); |
730 | mWeekFont = font(); | 751 | mWeekFont = font(); |
731 | 752 | ||
732 | int fontPoint = mWeekFont.pointSize(); | 753 | int fontPoint = mWeekFont.pointSize(); |
733 | QFontMetrics f( mWeekFont ); | 754 | QFontMetrics f( mWeekFont ); |
734 | int fontWid = f.width( "30" ); | 755 | int fontWid = f.width( "30" ); |
735 | while ( fontWid > pixWid ) { | 756 | while ( fontWid > pixWid ) { |
736 | --fontPoint; | 757 | --fontPoint; |
737 | mWeekFont.setPointSize( fontPoint ); | 758 | mWeekFont.setPointSize( fontPoint ); |
738 | QFontMetrics f( mWeekFont ); | 759 | QFontMetrics f( mWeekFont ); |
739 | fontWid = f.width( "30" ); | 760 | fontWid = f.width( "30" ); |
740 | //qDebug("dec-- "); | 761 | //qDebug("dec-- "); |
741 | } | 762 | } |
742 | 763 | ||
743 | connect( mWeekAction, SIGNAL( activated() ), | 764 | connect( mWeekAction, SIGNAL( activated() ), |
744 | this, SLOT( weekAction() ) ); | 765 | this, SLOT( weekAction() ) ); |
745 | 766 | ||
746 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 767 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
747 | if ( p->mShowIconFilterview ) { | 768 | if ( p->mShowIconFilterview ) { |
748 | icon = loadPixmap( pathString + "filter" ); | 769 | icon = loadPixmap( pathString + "filter" ); |
749 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 770 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
750 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 771 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
751 | this, SLOT( fillFilterMenuTB() ) ); | 772 | this, SLOT( fillFilterMenuTB() ) ); |
752 | actionFilterMenuTB->addTo( iconToolBar ); | 773 | actionFilterMenuTB->addTo( iconToolBar ); |
753 | selectFilterMenuTB = new QPopupMenu( this ); | 774 | selectFilterMenuTB = new QPopupMenu( this ); |
754 | selectFilterMenuTB->setCheckable( true ); | 775 | selectFilterMenuTB->setCheckable( true ); |
755 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 776 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
756 | } | 777 | } |
757 | 778 | ||
758 | //#endif | 779 | //#endif |
759 | // ****************** | 780 | // ****************** |
760 | QAction *action; | 781 | QAction *action; |
761 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 782 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
762 | configureToolBarMenu->setCheckable( true ); | 783 | configureToolBarMenu->setCheckable( true ); |
763 | 784 | ||
764 | 785 | ||
765 | configureAgendaMenu->setCheckable( true ); | 786 | configureAgendaMenu->setCheckable( true ); |
766 | int iii ; | 787 | int iii ; |
767 | for ( iii = 1;iii<= 10 ;++iii ){ | 788 | for ( iii = 1;iii<= 10 ;++iii ){ |
768 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 789 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
769 | } | 790 | } |
770 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 791 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
771 | 792 | ||
772 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 793 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
773 | this, SLOT( showConfigureAgenda( ) ) ); | 794 | this, SLOT( showConfigureAgenda( ) ) ); |
774 | icon = loadPixmap( pathString + "today" ); | 795 | icon = loadPixmap( pathString + "today" ); |
775 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 796 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
776 | today_action->addTo( actionMenu ); | 797 | today_action->addTo( actionMenu ); |
777 | connect( today_action, SIGNAL( activated() ), | 798 | connect( today_action, SIGNAL( activated() ), |
778 | mView, SLOT( goToday() ) ); | 799 | mView, SLOT( goToday() ) ); |
779 | 800 | ||
780 | icon = loadPixmap( pathString + "picker" ); | 801 | icon = loadPixmap( pathString + "picker" ); |
781 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); | 802 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); |
782 | dPickerAction->addTo( actionMenu ); | 803 | dPickerAction->addTo( actionMenu ); |
783 | connect( dPickerAction, SIGNAL( activated() ), | 804 | connect( dPickerAction, SIGNAL( activated() ), |
784 | mView, SLOT( showDatePicker() ) ); | 805 | mView, SLOT( showDatePicker() ) ); |
785 | 806 | ||
786 | icon = loadPixmap( pathString + "search" ); | 807 | icon = loadPixmap( pathString + "search" ); |
787 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 808 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
788 | search_action->addTo( actionMenu ); | 809 | search_action->addTo( actionMenu ); |
789 | connect( search_action, SIGNAL( activated() ), | 810 | connect( search_action, SIGNAL( activated() ), |
790 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 811 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
791 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); | 812 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); |
792 | 813 | ||
793 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); | 814 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); |
794 | action->addTo( nextConflictMenu ); | 815 | action->addTo( nextConflictMenu ); |
795 | connect( action, SIGNAL( activated() ), | 816 | connect( action, SIGNAL( activated() ), |
796 | mView, SLOT( conflictAll() ) ); | 817 | mView, SLOT( conflictAll() ) ); |
797 | 818 | ||
798 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); | 819 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); |
799 | action->addTo( nextConflictMenu ); | 820 | action->addTo( nextConflictMenu ); |
800 | connect( action, SIGNAL( activated() ), | 821 | connect( action, SIGNAL( activated() ), |
801 | mView, SLOT( conflictAllday() ) ); | 822 | mView, SLOT( conflictAllday() ) ); |
802 | 823 | ||
803 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); | 824 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); |
804 | action->addTo( nextConflictMenu ); | 825 | action->addTo( nextConflictMenu ); |
805 | connect( action, SIGNAL( activated() ), | 826 | connect( action, SIGNAL( activated() ), |
806 | mView, SLOT( conflictNotAll() ) ); | 827 | mView, SLOT( conflictNotAll() ) ); |
807 | 828 | ||
808 | actionMenu->insertSeparator(); | 829 | actionMenu->insertSeparator(); |
809 | 830 | ||
810 | icon = loadPixmap( pathString + "newevent" ); | 831 | icon = loadPixmap( pathString + "newevent" ); |
811 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 832 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
812 | ne_action->addTo( mCurrentItemMenu ); | 833 | ne_action->addTo( mCurrentItemMenu ); |
813 | connect( ne_action, SIGNAL( activated() ), | 834 | connect( ne_action, SIGNAL( activated() ), |
814 | mView, SLOT( newEvent() ) ); | 835 | mView, SLOT( newEvent() ) ); |
815 | icon = loadPixmap( pathString + "newtodo" ); | 836 | icon = loadPixmap( pathString + "newtodo" ); |
816 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 837 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
817 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 838 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
818 | nt_action->addTo( mCurrentItemMenu ); | 839 | nt_action->addTo( mCurrentItemMenu ); |
819 | connect( nt_action, SIGNAL( activated() ), | 840 | connect( nt_action, SIGNAL( activated() ), |
820 | mView, SLOT( newTodo() ) ); | 841 | mView, SLOT( newTodo() ) ); |
821 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 842 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
822 | this ); | 843 | this ); |
823 | mNewSubTodoAction->addTo( mCurrentItemMenu ); | 844 | mNewSubTodoAction->addTo( mCurrentItemMenu ); |
824 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 845 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
825 | mView, SLOT( newSubTodo() ) ); | 846 | mView, SLOT( newSubTodo() ) ); |
826 | 847 | ||
827 | mCurrentItemMenu->insertSeparator(); | 848 | mCurrentItemMenu->insertSeparator(); |
828 | icon = loadPixmap( pathString + "newevent" ); | 849 | icon = loadPixmap( pathString + "newevent" ); |
829 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 850 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
830 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 851 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
831 | configureToolBarMenu->insertSeparator(); | 852 | configureToolBarMenu->insertSeparator(); |
832 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 853 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
833 | configureToolBarMenu->insertSeparator(); | 854 | configureToolBarMenu->insertSeparator(); |
834 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 855 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
835 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 856 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
836 | 857 | ||
837 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); | 858 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); |
838 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); | 859 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); |
839 | mShowAction->addTo( mCurrentItemMenu ); | 860 | mShowAction->addTo( mCurrentItemMenu ); |
840 | connect( mShowAction, SIGNAL( activated() ), | 861 | connect( mShowAction, SIGNAL( activated() ), |
841 | mView, SLOT( showIncidence() ) ); | 862 | mView, SLOT( showIncidence() ) ); |
842 | 863 | ||
843 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 864 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
844 | mEditAction->addTo( mCurrentItemMenu ); | 865 | mEditAction->addTo( mCurrentItemMenu ); |
845 | connect( mEditAction, SIGNAL( activated() ), | 866 | connect( mEditAction, SIGNAL( activated() ), |
846 | mView, SLOT( editIncidence() ) ); | 867 | mView, SLOT( editIncidence() ) ); |
847 | 868 | ||
848 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 869 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
849 | mDeleteAction->addTo( mCurrentItemMenu ); | 870 | mDeleteAction->addTo( mCurrentItemMenu ); |
850 | connect( mDeleteAction, SIGNAL( activated() ), | 871 | connect( mDeleteAction, SIGNAL( activated() ), |
851 | mView, SLOT( deleteIncidence() ) ); | 872 | mView, SLOT( deleteIncidence() ) ); |
852 | 873 | ||
853 | 874 | ||
854 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 875 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
855 | mCloneAction->addTo( mCurrentItemMenu ); | 876 | mCloneAction->addTo( mCurrentItemMenu ); |
856 | connect( mCloneAction, SIGNAL( activated() ), | 877 | connect( mCloneAction, SIGNAL( activated() ), |
857 | mView, SLOT( cloneIncidence() ) ); | 878 | mView, SLOT( cloneIncidence() ) ); |
858 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 879 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
859 | mMoveAction->addTo( mCurrentItemMenu ); | 880 | mMoveAction->addTo( mCurrentItemMenu ); |
860 | connect( mMoveAction, SIGNAL( activated() ), | 881 | connect( mMoveAction, SIGNAL( activated() ), |
861 | mView, SLOT( moveIncidence() ) ); | 882 | mView, SLOT( moveIncidence() ) ); |
862 | #ifndef DESKTOP_VERSION | 883 | #ifndef DESKTOP_VERSION |
863 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 884 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
864 | mBeamAction->addTo(mCurrentItemMenu ); | 885 | mBeamAction->addTo(mCurrentItemMenu ); |
865 | connect( mBeamAction, SIGNAL( activated() ), | 886 | connect( mBeamAction, SIGNAL( activated() ), |
866 | mView, SLOT( beamIncidence() ) ); | 887 | mView, SLOT( beamIncidence() ) ); |
867 | #endif | 888 | #endif |
868 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 889 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
869 | mCancelAction->addTo( mCurrentItemMenu ); | 890 | mCancelAction->addTo( mCurrentItemMenu ); |
870 | connect( mCancelAction, SIGNAL( activated() ), | 891 | connect( mCancelAction, SIGNAL( activated() ), |
871 | mView, SLOT( toggleCancelIncidence() ) ); | 892 | mView, SLOT( toggleCancelIncidence() ) ); |
872 | 893 | ||
873 | 894 | ||
874 | mCurrentItemMenu->insertSeparator(); | 895 | mCurrentItemMenu->insertSeparator(); |
875 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 896 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
876 | action->addTo( mCurrentItemMenu ); | 897 | action->addTo( mCurrentItemMenu ); |
877 | connect( action, SIGNAL( activated() ), | 898 | connect( action, SIGNAL( activated() ), |
878 | mView, SLOT( undo_delete() ) ); | 899 | mView, SLOT( undo_delete() ) ); |
879 | 900 | ||
880 | // *********************** | 901 | // *********************** |
881 | if ( KOPrefs::instance()->mVerticalScreen ) { | 902 | if ( KOPrefs::instance()->mVerticalScreen ) { |
882 | icon = SmallIcon( "1updownarrow" ); | 903 | icon = SmallIcon( "1updownarrow" ); |
883 | } else { | 904 | } else { |
884 | icon = SmallIcon("1leftrightarrow" ); | 905 | icon = SmallIcon("1leftrightarrow" ); |
885 | } | 906 | } |
886 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 907 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
887 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 908 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
888 | FSaction->addTo( viewMenu ); | 909 | FSaction->addTo( viewMenu ); |
889 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 910 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
890 | 911 | ||
891 | 912 | ||
892 | icon = loadPixmap( pathString + "filter" ); | 913 | icon = loadPixmap( pathString + "filter" ); |
893 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 914 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
894 | icon = loadPixmap( pathString + "configure" ); | 915 | icon = loadPixmap( pathString + "configure" ); |
895 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); | 916 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); |
896 | action->addTo( viewMenu ); | 917 | action->addTo( viewMenu ); |
897 | connect( action, SIGNAL( activated() ), | 918 | connect( action, SIGNAL( activated() ), |
898 | mView, SLOT( toggleFilter() ) ); | 919 | mView, SLOT( toggleFilter() ) ); |
899 | mToggleFilter = action; | 920 | mToggleFilter = action; |
900 | icon = loadPixmap( pathString + "navi" ); | 921 | icon = loadPixmap( pathString + "navi" ); |
901 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 922 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
902 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 923 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
903 | action->addTo( viewMenu ); | 924 | action->addTo( viewMenu ); |
904 | connect( action, SIGNAL( activated() ), | 925 | connect( action, SIGNAL( activated() ), |
905 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 926 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
906 | mToggleNav = action ; | 927 | mToggleNav = action ; |
907 | icon = loadPixmap( pathString + "allday" ); | 928 | icon = loadPixmap( pathString + "allday" ); |
908 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 929 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
909 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 930 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
910 | action->addTo( viewMenu ); | 931 | action->addTo( viewMenu ); |
911 | connect( action, SIGNAL( activated() ), | 932 | connect( action, SIGNAL( activated() ), |
912 | mView, SLOT( toggleAllDaySize() ) ); | 933 | mView, SLOT( toggleAllDaySize() ) ); |
913 | mToggleAllday = action; | 934 | mToggleAllday = action; |
914 | 935 | ||
915 | 936 | ||
916 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 937 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
917 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 938 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
918 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 939 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
919 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 940 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
920 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 941 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
921 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 942 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
922 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 943 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
923 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | 944 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); |
924 | 945 | ||
925 | 946 | ||
926 | dPickerAction->addTo( iconToolBar ); | 947 | dPickerAction->addTo( iconToolBar ); |
927 | viewMenu->insertSeparator(); | 948 | viewMenu->insertSeparator(); |
928 | 949 | ||
929 | if ( p-> mShowIconToggleFull ) | 950 | if ( p-> mShowIconToggleFull ) |
930 | FSaction->addTo( iconToolBar ); | 951 | FSaction->addTo( iconToolBar ); |
931 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 952 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
932 | 953 | ||
933 | //******************** | 954 | //******************** |
934 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 955 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
935 | 956 | ||
936 | 957 | ||
937 | icon = loadPixmap( pathString + "whatsnext" ); | 958 | icon = loadPixmap( pathString + "whatsnext" ); |
938 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 959 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
939 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 960 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
940 | whatsnext_action->addTo( viewMenu ); | 961 | whatsnext_action->addTo( viewMenu ); |
941 | connect( whatsnext_action, SIGNAL( activated() ), | 962 | connect( whatsnext_action, SIGNAL( activated() ), |
942 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 963 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
943 | 964 | ||
944 | icon = loadPixmap( pathString + "xdays" ); | 965 | icon = loadPixmap( pathString + "xdays" ); |
945 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 966 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
946 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 967 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
947 | xdays_action->addTo( viewMenu ); | 968 | xdays_action->addTo( viewMenu ); |
948 | connect( xdays_action, SIGNAL( activated() ), | 969 | connect( xdays_action, SIGNAL( activated() ), |
949 | mView->viewManager(), SLOT( showNextXView() ) ); | 970 | mView->viewManager(), SLOT( showNextXView() ) ); |
950 | 971 | ||
951 | 972 | ||
952 | icon = loadPixmap( pathString + "journal" ); | 973 | icon = loadPixmap( pathString + "journal" ); |
953 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 974 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
954 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 975 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
955 | viewjournal_action->addTo( viewMenu ); | 976 | viewjournal_action->addTo( viewMenu ); |
956 | connect( viewjournal_action, SIGNAL( activated() ), | 977 | connect( viewjournal_action, SIGNAL( activated() ), |
957 | mView->viewManager(), SLOT( showJournalView() ) ); | 978 | mView->viewManager(), SLOT( showJournalView() ) ); |
958 | 979 | ||
959 | 980 | ||
960 | icon = loadPixmap( pathString + "day" ); | 981 | icon = loadPixmap( pathString + "day" ); |
961 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 982 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
962 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 983 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
963 | day1_action->addTo( viewMenu ); | 984 | day1_action->addTo( viewMenu ); |
964 | // action->addTo( toolBar ); | 985 | // action->addTo( toolBar ); |
965 | connect( day1_action, SIGNAL( activated() ), | 986 | connect( day1_action, SIGNAL( activated() ), |
966 | mView->viewManager(), SLOT( showDayView() ) ); | 987 | mView->viewManager(), SLOT( showDayView() ) ); |
967 | 988 | ||
968 | icon = loadPixmap( pathString + "workweek" ); | 989 | icon = loadPixmap( pathString + "workweek" ); |
969 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 990 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
970 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 991 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
971 | day5_action->addTo( viewMenu ); | 992 | day5_action->addTo( viewMenu ); |
972 | connect( day5_action, SIGNAL( activated() ), | 993 | connect( day5_action, SIGNAL( activated() ), |
973 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 994 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
974 | 995 | ||
975 | icon = loadPixmap( pathString + "week" ); | 996 | icon = loadPixmap( pathString + "week" ); |
976 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 997 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
977 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 998 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
978 | day7_action->addTo( viewMenu ); | 999 | day7_action->addTo( viewMenu ); |
979 | connect( day7_action, SIGNAL( activated() ), | 1000 | connect( day7_action, SIGNAL( activated() ), |
980 | mView->viewManager(), SLOT( showWeekView() ) ); | 1001 | mView->viewManager(), SLOT( showWeekView() ) ); |
981 | 1002 | ||
982 | icon = loadPixmap( pathString + "workweek2" ); | 1003 | icon = loadPixmap( pathString + "workweek2" ); |
983 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 1004 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
984 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 1005 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
985 | day6_action->addTo( viewMenu ); | 1006 | day6_action->addTo( viewMenu ); |
986 | connect( day6_action, SIGNAL( activated() ), | 1007 | connect( day6_action, SIGNAL( activated() ), |
987 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 1008 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
988 | 1009 | ||
989 | icon = loadPixmap( pathString + "month" ); | 1010 | icon = loadPixmap( pathString + "month" ); |
990 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 1011 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
991 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 1012 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
992 | month_action->addTo( viewMenu ); | 1013 | month_action->addTo( viewMenu ); |
993 | connect( month_action, SIGNAL( activated() ), | 1014 | connect( month_action, SIGNAL( activated() ), |
994 | mView->viewManager(), SLOT( showMonthView() ) ); | 1015 | mView->viewManager(), SLOT( showMonthView() ) ); |
995 | 1016 | ||
996 | icon = loadPixmap( pathString + "list" ); | 1017 | icon = loadPixmap( pathString + "list" ); |
997 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 1018 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
998 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 1019 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
999 | showlist_action->addTo( viewMenu ); | 1020 | showlist_action->addTo( viewMenu ); |
1000 | connect( showlist_action, SIGNAL( activated() ), | 1021 | connect( showlist_action, SIGNAL( activated() ), |
1001 | mView->viewManager(), SLOT( showListView() ) ); | 1022 | mView->viewManager(), SLOT( showListView() ) ); |
1002 | 1023 | ||
1003 | icon = loadPixmap( pathString + "todo" ); | 1024 | icon = loadPixmap( pathString + "todo" ); |
1004 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 1025 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
1005 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 1026 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
1006 | todoview_action->addTo( viewMenu ); | 1027 | todoview_action->addTo( viewMenu ); |
1007 | connect( todoview_action, SIGNAL( activated() ), | 1028 | connect( todoview_action, SIGNAL( activated() ), |
1008 | mView->viewManager(), SLOT( showTodoView() ) ); | 1029 | mView->viewManager(), SLOT( showTodoView() ) ); |
1009 | 1030 | ||
1010 | 1031 | ||
1011 | 1032 | ||
1012 | #if 0 | 1033 | #if 0 |
1013 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 1034 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
1014 | action->addTo( viewMenu ); | 1035 | action->addTo( viewMenu ); |
1015 | connect( action, SIGNAL( activated() ), | 1036 | connect( action, SIGNAL( activated() ), |
1016 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 1037 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
1017 | #endif | 1038 | #endif |
1018 | 1039 | ||
1019 | 1040 | ||
1020 | 1041 | ||
1021 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, | 1042 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, |
1022 | this ); | 1043 | this ); |
1023 | action->addTo( actionMenu ); | 1044 | action->addTo( actionMenu ); |
1024 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 1045 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
1025 | 1046 | ||
1026 | 1047 | ||
1027 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 1048 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
1028 | 1049 | ||
1029 | 1050 | ||
1030 | 1051 | ||
1031 | actionMenu->insertSeparator(); | 1052 | actionMenu->insertSeparator(); |
1032 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, | 1053 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, |
1033 | this ); | 1054 | this ); |
1034 | action->addTo( actionMenu ); | 1055 | action->addTo( actionMenu ); |
1035 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); | 1056 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); |
1036 | 1057 | ||
1037 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1058 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1038 | this ); | 1059 | this ); |
1039 | action->addTo( actionMenu ); | 1060 | action->addTo( actionMenu ); |
1040 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1061 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1041 | 1062 | ||
1042 | 1063 | ||
1043 | actionMenu->insertSeparator(); | 1064 | actionMenu->insertSeparator(); |
1044 | icon = loadPixmap( pathString + "configure" ); | 1065 | icon = loadPixmap( pathString + "configure" ); |
1045 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); | 1066 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); |
1046 | action->addTo( actionMenu ); | 1067 | action->addTo( actionMenu ); |
1047 | connect( action, SIGNAL( activated() ), | 1068 | connect( action, SIGNAL( activated() ), |
1048 | mView, SLOT( edit_options() ) ); | 1069 | mView, SLOT( edit_options() ) ); |
1049 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); | 1070 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); |
1050 | action->addTo( actionMenu ); | 1071 | action->addTo( actionMenu ); |
1051 | connect( action, SIGNAL( activated() ), | 1072 | connect( action, SIGNAL( activated() ), |
1052 | this, SLOT( calHint() ) ); | 1073 | this, SLOT( calHint() ) ); |
1053 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); | 1074 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); |
1054 | action->addTo( actionMenu ); | 1075 | action->addTo( actionMenu ); |
1055 | connect( action, SIGNAL( activated() ), | 1076 | connect( action, SIGNAL( activated() ), |
1056 | mView, SLOT( edit_global_options() ) ); | 1077 | mView, SLOT( edit_global_options() ) ); |
1057 | if ( KOPrefs::instance()->mShowFullMenu ) { | 1078 | if ( KOPrefs::instance()->mShowFullMenu ) { |
1058 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 1079 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
1059 | 1080 | ||
1060 | } | 1081 | } |
1061 | // actionMenu->insertSeparator(); | 1082 | // actionMenu->insertSeparator(); |
1062 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 1083 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
1063 | this ); | 1084 | this ); |
1064 | action->addTo( importMenu_X ); | 1085 | action->addTo( importMenu_X ); |
1065 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 1086 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
1066 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 1087 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
1067 | this ); | 1088 | this ); |
1068 | action->addTo( importMenu_X ); | 1089 | action->addTo( importMenu_X ); |
1069 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 1090 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
1070 | importMenu_X->insertSeparator(); | 1091 | importMenu_X->insertSeparator(); |
1071 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 1092 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
1072 | this ); | 1093 | this ); |
1073 | action->addTo( importMenu_X ); | 1094 | action->addTo( importMenu_X ); |
1074 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 1095 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
1075 | //#ifndef DESKTOP_VERSION | 1096 | //#ifndef DESKTOP_VERSION |
1076 | importMenu_X->insertSeparator(); | 1097 | importMenu_X->insertSeparator(); |
1077 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 1098 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
1078 | this ); | 1099 | this ); |
1079 | action->addTo( importMenu_X ); | 1100 | action->addTo( importMenu_X ); |
1080 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 1101 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
1081 | //#else | 1102 | //#else |
1082 | #ifdef _OL_IMPORT_ | 1103 | #ifdef _OL_IMPORT_ |
1083 | importMenu_X->insertSeparator(); | 1104 | importMenu_X->insertSeparator(); |
1084 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 1105 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
1085 | this ); | 1106 | this ); |
1086 | action->addTo( importMenu_X ); | 1107 | action->addTo( importMenu_X ); |
1087 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 1108 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
1088 | #endif | 1109 | #endif |
1089 | //#endif | 1110 | //#endif |
1090 | 1111 | ||
1091 | //importMenu->insertSeparator(); | 1112 | //importMenu->insertSeparator(); |
1092 | #if 0 | 1113 | #if 0 |
1093 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1114 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1094 | this ); | 1115 | this ); |
1095 | action->addTo( importMenu ); | 1116 | action->addTo( importMenu ); |
1096 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1117 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1097 | #endif | 1118 | #endif |
1098 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, | 1119 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, |
1099 | this ); | 1120 | this ); |
1100 | action->addTo( importMenu ); | 1121 | action->addTo( importMenu ); |
1101 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1122 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1102 | importMenu->insertSeparator(); | 1123 | importMenu->insertSeparator(); |
1103 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1124 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1104 | //importMenu->insertSeparator(); | 1125 | //importMenu->insertSeparator(); |
1105 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1126 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1106 | this ); | 1127 | this ); |
1107 | action->addTo( exportMenu_X ); | 1128 | action->addTo( exportMenu_X ); |
1108 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1129 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1109 | 1130 | ||
1110 | 1131 | ||
1111 | //LR | 1132 | //LR |
1112 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1133 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1113 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1134 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1114 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1135 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1115 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1136 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1116 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1137 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1117 | 1138 | ||
1118 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1139 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1119 | mPrintSelAction = 0; | 1140 | mPrintSelAction = 0; |
1120 | #ifndef DESKTOP_VERSION | 1141 | #ifndef DESKTOP_VERSION |
1121 | //importMenu->insertSeparator(); | 1142 | //importMenu->insertSeparator(); |
1122 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1143 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1123 | this ); | 1144 | this ); |
1124 | brAction->addTo( beamMenu_X ); | 1145 | brAction->addTo( beamMenu_X ); |
1125 | brAction->setToggleAction (true ) ; | 1146 | brAction->setToggleAction (true ) ; |
1126 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1147 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1127 | 1148 | ||
1128 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1149 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1129 | this ); | 1150 | this ); |
1130 | action->addTo( beamMenu_X ); | 1151 | action->addTo( beamMenu_X ); |
1131 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1152 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1132 | 1153 | ||
1133 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1154 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1134 | this ); | 1155 | this ); |
1135 | action->addTo( beamMenu_X ); | 1156 | action->addTo( beamMenu_X ); |
1136 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1157 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1137 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1158 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1138 | #else | 1159 | #else |
1139 | //importMenu->insertSeparator(); | 1160 | //importMenu->insertSeparator(); |
1140 | icon = loadPixmap( pathString + "print" ); | 1161 | icon = loadPixmap( pathString + "print" ); |
1141 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1162 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1142 | action->addTo( beamMenu_X ); | 1163 | action->addTo( beamMenu_X ); |
1143 | connect( action, SIGNAL( activated() ), | 1164 | connect( action, SIGNAL( activated() ), |
1144 | this, SLOT( printCal() ) ); | 1165 | this, SLOT( printCal() ) ); |
1145 | 1166 | ||
1146 | icon = loadPixmap( pathString + "week" ); | 1167 | icon = loadPixmap( pathString + "week" ); |
1147 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1168 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1148 | action->addTo( beamMenu_X ); | 1169 | action->addTo( beamMenu_X ); |
1149 | connect( action, SIGNAL( activated() ), | 1170 | connect( action, SIGNAL( activated() ), |
1150 | this, SLOT( printSel() ) ); | 1171 | this, SLOT( printSel() ) ); |
1151 | icon = loadPixmap( pathString + "whatsnext" ); | 1172 | icon = loadPixmap( pathString + "whatsnext" ); |
1152 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1173 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1153 | action->addTo( beamMenu_X ); | 1174 | action->addTo( beamMenu_X ); |
1154 | connect( action, SIGNAL( activated() ), | 1175 | connect( action, SIGNAL( activated() ), |
1155 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1176 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1156 | 1177 | ||
1157 | 1178 | ||
1158 | icon = loadPixmap( pathString + "list" ); | 1179 | icon = loadPixmap( pathString + "list" ); |
1159 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); | 1180 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); |
1160 | action->addTo( beamMenu_X ); | 1181 | action->addTo( beamMenu_X ); |
1161 | connect( action, SIGNAL( activated() ), | 1182 | connect( action, SIGNAL( activated() ), |
1162 | this, SLOT( printListView() ) ); | 1183 | this, SLOT( printListView() ) ); |
1163 | 1184 | ||
1164 | icon = loadPixmap( pathString + "newevent" ); | 1185 | icon = loadPixmap( pathString + "newevent" ); |
1165 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1186 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1166 | action->addTo( beamMenu_X ); | 1187 | action->addTo( beamMenu_X ); |
1167 | connect( action, SIGNAL( activated() ), | 1188 | connect( action, SIGNAL( activated() ), |
1168 | mView, SLOT( slotprintSelInc() ) ); | 1189 | mView, SLOT( slotprintSelInc() ) ); |
1169 | mPrintSelAction = action; | 1190 | mPrintSelAction = action; |
1170 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1191 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1171 | #endif | 1192 | #endif |
1172 | 1193 | ||
1173 | importMenu->insertSeparator(); | 1194 | importMenu->insertSeparator(); |
1174 | action = new QAction( "beam all", i18n("Save"), 0, | 1195 | action = new QAction( "beam all", i18n("Save"), 0, |
1175 | this ); | 1196 | this ); |
1176 | action->addTo( importMenu ); | 1197 | action->addTo( importMenu ); |
1177 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1198 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1178 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1199 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1179 | this ); | 1200 | this ); |
1180 | action->addTo( importMenu ); | 1201 | action->addTo( importMenu ); |
1181 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1202 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1182 | 1203 | ||
1183 | //menuBar->insertItem( "Configure",configureMenu ); | 1204 | //menuBar->insertItem( "Configure",configureMenu ); |
1184 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1205 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1185 | icon = loadPixmap( "korganizer/korganizer" ); | 1206 | icon = loadPixmap( "korganizer/korganizer" ); |
1186 | 1207 | ||
1187 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1208 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1188 | action->addTo( helpMenu ); | 1209 | action->addTo( helpMenu ); |
1189 | connect( action, SIGNAL( activated() ), | 1210 | connect( action, SIGNAL( activated() ), |
1190 | SLOT( whatsNew() ) ); | 1211 | SLOT( whatsNew() ) ); |
1191 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1212 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1192 | action->addTo( helpMenu ); | 1213 | action->addTo( helpMenu ); |
1193 | connect( action, SIGNAL( activated() ), | 1214 | connect( action, SIGNAL( activated() ), |
1194 | SLOT( features() ) ); | 1215 | SLOT( features() ) ); |
1195 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1216 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1196 | action->addTo( helpMenu ); | 1217 | action->addTo( helpMenu ); |
1197 | connect( action, SIGNAL( activated() ), | 1218 | connect( action, SIGNAL( activated() ), |
1198 | SLOT( keyBindings() ) ); | 1219 | SLOT( keyBindings() ) ); |
1199 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1220 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1200 | action->addTo( helpMenu ); | 1221 | action->addTo( helpMenu ); |
1201 | connect( action, SIGNAL( activated() ), | 1222 | connect( action, SIGNAL( activated() ), |
1202 | SLOT( storagehowto() ) ); | 1223 | SLOT( storagehowto() ) ); |
1203 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1224 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1204 | action->addTo( helpMenu ); | 1225 | action->addTo( helpMenu ); |
1205 | connect( action, SIGNAL( activated() ), | 1226 | connect( action, SIGNAL( activated() ), |
1206 | SLOT( timetrackinghowto() ) ); | 1227 | SLOT( timetrackinghowto() ) ); |
1207 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1228 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1208 | action->addTo( helpMenu ); | 1229 | action->addTo( helpMenu ); |
1209 | connect( action, SIGNAL( activated() ), | 1230 | connect( action, SIGNAL( activated() ), |
1210 | SLOT( synchowto() ) ); | 1231 | SLOT( synchowto() ) ); |
1211 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1232 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1212 | action->addTo( helpMenu ); | 1233 | action->addTo( helpMenu ); |
1213 | connect( action, SIGNAL( activated() ), | 1234 | connect( action, SIGNAL( activated() ), |
1214 | SLOT( kdesynchowto() ) ); | 1235 | SLOT( kdesynchowto() ) ); |
1215 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1236 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1216 | action->addTo( helpMenu ); | 1237 | action->addTo( helpMenu ); |
1217 | connect( action, SIGNAL( activated() ), | 1238 | connect( action, SIGNAL( activated() ), |
1218 | SLOT( multisynchowto() ) ); | 1239 | SLOT( multisynchowto() ) ); |
1219 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1240 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1220 | action->addTo( helpMenu ); | 1241 | action->addTo( helpMenu ); |
1221 | connect( action, SIGNAL( activated() ), | 1242 | connect( action, SIGNAL( activated() ), |
1222 | SLOT( aboutAutoSaving() ) ); | 1243 | SLOT( aboutAutoSaving() ) ); |
1223 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1244 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1224 | action->addTo( helpMenu ); | 1245 | action->addTo( helpMenu ); |
1225 | connect( action, SIGNAL( activated() ), | 1246 | connect( action, SIGNAL( activated() ), |
1226 | SLOT( aboutKnownBugs() ) ); | 1247 | SLOT( aboutKnownBugs() ) ); |
1227 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1248 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1228 | action->addTo( helpMenu ); | 1249 | action->addTo( helpMenu ); |
1229 | connect( action, SIGNAL( activated() ), | 1250 | connect( action, SIGNAL( activated() ), |
1230 | SLOT( usertrans() ) ); | 1251 | SLOT( usertrans() ) ); |
1231 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1252 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1232 | action->addTo( helpMenu ); | 1253 | action->addTo( helpMenu ); |
1233 | connect( action, SIGNAL( activated() ), | 1254 | connect( action, SIGNAL( activated() ), |
1234 | SLOT( faq() ) ); | 1255 | SLOT( faq() ) ); |
1235 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1256 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1236 | action->addTo( helpMenu ); | 1257 | action->addTo( helpMenu ); |
1237 | connect( action, SIGNAL( activated() ), | 1258 | connect( action, SIGNAL( activated() ), |
1238 | SLOT( licence() ) ); | 1259 | SLOT( licence() ) ); |
1239 | action = new QAction( "about", i18n("About..."), 0, this ); | 1260 | action = new QAction( "about", i18n("About..."), 0, this ); |
1240 | action->addTo( helpMenu ); | 1261 | action->addTo( helpMenu ); |
1241 | connect( action, SIGNAL( activated() ), | 1262 | connect( action, SIGNAL( activated() ), |
1242 | SLOT( about() ) ); | 1263 | SLOT( about() ) ); |
1243 | //menuBar->insertSeparator(); | 1264 | //menuBar->insertSeparator(); |
1244 | 1265 | ||
1245 | // ****************************************************** | 1266 | // ****************************************************** |
1246 | // menubar icons | 1267 | // menubar icons |
1247 | 1268 | ||
1248 | 1269 | ||
1249 | 1270 | ||
1250 | //menuBar->insertItem( iconToolBar ); | 1271 | //menuBar->insertItem( iconToolBar ); |
1251 | //xdays_action | 1272 | //xdays_action |
1252 | if (p-> mShowIconNewEvent) | 1273 | if (p-> mShowIconNewEvent) |
1253 | ne_action->addTo( iconToolBar ); | 1274 | ne_action->addTo( iconToolBar ); |
1254 | if (p->mShowIconNewTodo ) | 1275 | if (p->mShowIconNewTodo ) |
1255 | nt_action->addTo( iconToolBar ); | 1276 | nt_action->addTo( iconToolBar ); |
1256 | if (p-> mShowIconSearch) | 1277 | if (p-> mShowIconSearch) |
1257 | search_action->addTo( iconToolBar ); | 1278 | search_action->addTo( iconToolBar ); |
1258 | if (p-> mShowIconWhatsThis) | 1279 | if (p-> mShowIconWhatsThis) |
1259 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1280 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1260 | if (p-> mShowIconNext) | 1281 | if (p-> mShowIconNext) |
1261 | whatsnext_action->addTo( viewToolBar ); | 1282 | whatsnext_action->addTo( viewToolBar ); |
1262 | if (p-> mShowIconNextDays) | 1283 | if (p-> mShowIconNextDays) |
1263 | xdays_action->addTo( viewToolBar ); | 1284 | xdays_action->addTo( viewToolBar ); |
1264 | if (p-> mShowIconJournal) | 1285 | if (p-> mShowIconJournal) |
1265 | viewjournal_action->addTo( viewToolBar ); | 1286 | viewjournal_action->addTo( viewToolBar ); |
1266 | if (p-> mShowIconDay1) | 1287 | if (p-> mShowIconDay1) |
1267 | day1_action->addTo( viewToolBar ); | 1288 | day1_action->addTo( viewToolBar ); |
1268 | if (p-> mShowIconDay5) | 1289 | if (p-> mShowIconDay5) |
1269 | day5_action->addTo( viewToolBar ); | 1290 | day5_action->addTo( viewToolBar ); |
1270 | if (p-> mShowIconDay7) | 1291 | if (p-> mShowIconDay7) |
1271 | day7_action->addTo( viewToolBar ); | 1292 | day7_action->addTo( viewToolBar ); |
1272 | if (p-> mShowIconDay6) | 1293 | if (p-> mShowIconDay6) |
1273 | day6_action->addTo( viewToolBar ); | 1294 | day6_action->addTo( viewToolBar ); |
1274 | if (p-> mShowIconMonth) | 1295 | if (p-> mShowIconMonth) |
1275 | month_action->addTo( viewToolBar ); | 1296 | month_action->addTo( viewToolBar ); |
1276 | if (p-> mShowIconList) | 1297 | if (p-> mShowIconList) |
1277 | showlist_action->addTo( viewToolBar ); | 1298 | showlist_action->addTo( viewToolBar ); |
1278 | if (p-> mShowIconTodoview) | 1299 | if (p-> mShowIconTodoview) |
1279 | todoview_action->addTo( viewToolBar ); | 1300 | todoview_action->addTo( viewToolBar ); |
1280 | 1301 | ||
1281 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1302 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1282 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1303 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1283 | if (p-> mShowIconBackFast) { | 1304 | if (p-> mShowIconBackFast) { |
1284 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1305 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1285 | connect( action, SIGNAL( activated() ), | 1306 | connect( action, SIGNAL( activated() ), |
1286 | mView, SLOT( goPreviousMonth() ) ); | 1307 | mView, SLOT( goPreviousMonth() ) ); |
1287 | action->addTo( navigatorToolBar ); | 1308 | action->addTo( navigatorToolBar ); |
1288 | } | 1309 | } |
1289 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1310 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1290 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1311 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1291 | if (p-> mShowIconBack) { | 1312 | if (p-> mShowIconBack) { |
1292 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1313 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1293 | connect( action, SIGNAL( activated() ), | 1314 | connect( action, SIGNAL( activated() ), |
1294 | mView, SLOT( goPrevious() ) ); | 1315 | mView, SLOT( goPrevious() ) ); |
1295 | action->addTo( navigatorToolBar ); | 1316 | action->addTo( navigatorToolBar ); |
1296 | } | 1317 | } |
1297 | icon = loadPixmap( pathString + "today" ); | 1318 | icon = loadPixmap( pathString + "today" ); |
1298 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1319 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1299 | if (p-> mShowIconToday) | 1320 | if (p-> mShowIconToday) |
1300 | today_action->addTo( navigatorToolBar ); | 1321 | today_action->addTo( navigatorToolBar ); |
1301 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1322 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1302 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1323 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1303 | if (p-> mShowIconForward) { | 1324 | if (p-> mShowIconForward) { |
1304 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1325 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1305 | connect( action, SIGNAL( activated() ), | 1326 | connect( action, SIGNAL( activated() ), |
1306 | mView, SLOT( goNext() ) ); | 1327 | mView, SLOT( goNext() ) ); |
1307 | action->addTo( navigatorToolBar ); | 1328 | action->addTo( navigatorToolBar ); |
1308 | } | 1329 | } |
1309 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1330 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1310 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1331 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1311 | if (p-> mShowIconForwardFast) { | 1332 | if (p-> mShowIconForwardFast) { |
1312 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1333 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1313 | connect( action, SIGNAL( activated() ), | 1334 | connect( action, SIGNAL( activated() ), |
1314 | mView, SLOT( goNextMonth() ) ); | 1335 | mView, SLOT( goNextMonth() ) ); |
1315 | action->addTo( navigatorToolBar ); | 1336 | action->addTo( navigatorToolBar ); |
1316 | } | 1337 | } |
1317 | 1338 | ||
1318 | 1339 | ||
1319 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1340 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1320 | 1341 | ||
1321 | 1342 | ||
1322 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1343 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1323 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1344 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1324 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1345 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1325 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1346 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1326 | 1347 | ||
1327 | if (p-> mShowIconNewEvent) | 1348 | if (p-> mShowIconNewEvent) |
1328 | configureToolBarMenu->setItemChecked( 10, true ); | 1349 | configureToolBarMenu->setItemChecked( 10, true ); |
1329 | if (p->mShowIconNewTodo ) | 1350 | if (p->mShowIconNewTodo ) |
1330 | configureToolBarMenu->setItemChecked( 20, true ); | 1351 | configureToolBarMenu->setItemChecked( 20, true ); |
1331 | if (p-> mShowIconSearch) | 1352 | if (p-> mShowIconSearch) |
1332 | configureToolBarMenu->setItemChecked( 120, true ); | 1353 | configureToolBarMenu->setItemChecked( 120, true ); |
1333 | if (p-> mShowIconList) | 1354 | if (p-> mShowIconList) |
1334 | configureToolBarMenu->setItemChecked( 30, true ); | 1355 | configureToolBarMenu->setItemChecked( 30, true ); |
1335 | if (p-> mShowIconDay1) | 1356 | if (p-> mShowIconDay1) |
1336 | configureToolBarMenu->setItemChecked( 40, true ); | 1357 | configureToolBarMenu->setItemChecked( 40, true ); |
1337 | if (p-> mShowIconDay5) | 1358 | if (p-> mShowIconDay5) |
1338 | configureToolBarMenu->setItemChecked( 50, true ); | 1359 | configureToolBarMenu->setItemChecked( 50, true ); |
1339 | if (p-> mShowIconDay6) | 1360 | if (p-> mShowIconDay6) |
1340 | configureToolBarMenu->setItemChecked( 75, true ); | 1361 | configureToolBarMenu->setItemChecked( 75, true ); |
1341 | if (p-> mShowIconDay7) | 1362 | if (p-> mShowIconDay7) |
1342 | configureToolBarMenu->setItemChecked( 60, true ); | 1363 | configureToolBarMenu->setItemChecked( 60, true ); |
1343 | if (p-> mShowIconMonth) | 1364 | if (p-> mShowIconMonth) |
1344 | configureToolBarMenu->setItemChecked( 70, true ); | 1365 | configureToolBarMenu->setItemChecked( 70, true ); |
1345 | if (p-> mShowIconTodoview) | 1366 | if (p-> mShowIconTodoview) |
1346 | configureToolBarMenu->setItemChecked( 80, true ); | 1367 | configureToolBarMenu->setItemChecked( 80, true ); |
1347 | if (p-> mShowIconBackFast) | 1368 | if (p-> mShowIconBackFast) |
1348 | configureToolBarMenu->setItemChecked( 200, true ); | 1369 | configureToolBarMenu->setItemChecked( 200, true ); |
1349 | if (p-> mShowIconBack) | 1370 | if (p-> mShowIconBack) |
1350 | configureToolBarMenu->setItemChecked( 210, true ); | 1371 | configureToolBarMenu->setItemChecked( 210, true ); |
1351 | if (p-> mShowIconToday) | 1372 | if (p-> mShowIconToday) |
1352 | configureToolBarMenu->setItemChecked( 130, true ); | 1373 | configureToolBarMenu->setItemChecked( 130, true ); |
1353 | if (p-> mShowIconForward) | 1374 | if (p-> mShowIconForward) |
1354 | configureToolBarMenu->setItemChecked( 220, true ); | 1375 | configureToolBarMenu->setItemChecked( 220, true ); |
1355 | if (p-> mShowIconForwardFast) | 1376 | if (p-> mShowIconForwardFast) |
1356 | configureToolBarMenu->setItemChecked( 230, true ); | 1377 | configureToolBarMenu->setItemChecked( 230, true ); |
1357 | if (p-> mShowIconNextDays) | 1378 | if (p-> mShowIconNextDays) |
1358 | configureToolBarMenu->setItemChecked( 100, true ); | 1379 | configureToolBarMenu->setItemChecked( 100, true ); |
1359 | if (p-> mShowIconNext) | 1380 | if (p-> mShowIconNext) |
1360 | configureToolBarMenu->setItemChecked( 110, true ); | 1381 | configureToolBarMenu->setItemChecked( 110, true ); |
1361 | if (p-> mShowIconJournal) | 1382 | if (p-> mShowIconJournal) |
1362 | configureToolBarMenu->setItemChecked( 90, true ); | 1383 | configureToolBarMenu->setItemChecked( 90, true ); |
1363 | if (p-> mShowIconWhatsThis) | 1384 | if (p-> mShowIconWhatsThis) |
1364 | configureToolBarMenu->setItemChecked( 300, true ); | 1385 | configureToolBarMenu->setItemChecked( 300, true ); |
1365 | if (p-> mShowIconWeekNum) | 1386 | if (p-> mShowIconWeekNum) |
1366 | configureToolBarMenu->setItemChecked( 400, true ); | 1387 | configureToolBarMenu->setItemChecked( 400, true ); |
1367 | if (!p-> mShowIconStretch) { | 1388 | if (!p-> mShowIconStretch) { |
1368 | QLabel* dummy = new QLabel( iconToolBar ); | 1389 | QLabel* dummy = new QLabel( iconToolBar ); |
1369 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1390 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1370 | dummy->setMinimumWidth( 0 ); | 1391 | dummy->setMinimumWidth( 0 ); |
1371 | iconToolBar->setStretchableWidget ( dummy ) ; | 1392 | iconToolBar->setStretchableWidget ( dummy ) ; |
1372 | } | 1393 | } |
1373 | else { | 1394 | else { |
1374 | iconToolBar->setHorizontalStretchable (true ); | 1395 | iconToolBar->setHorizontalStretchable (true ); |
1375 | viewToolBar->setHorizontalStretchable (true ); | 1396 | viewToolBar->setHorizontalStretchable (true ); |
1376 | navigatorToolBar->setHorizontalStretchable (true ); | 1397 | navigatorToolBar->setHorizontalStretchable (true ); |
1377 | iconToolBar->setVerticalStretchable (true ); | 1398 | iconToolBar->setVerticalStretchable (true ); |
1378 | viewToolBar->setVerticalStretchable (true ); | 1399 | viewToolBar->setVerticalStretchable (true ); |
1379 | navigatorToolBar->setVerticalStretchable (true ); | 1400 | navigatorToolBar->setVerticalStretchable (true ); |
1380 | configureToolBarMenu->setItemChecked( 5, true ); | 1401 | configureToolBarMenu->setItemChecked( 5, true ); |
1381 | } | 1402 | } |
1382 | if (p-> mShowIconFilter) | 1403 | if (p-> mShowIconFilter) |
1383 | configureToolBarMenu->setItemChecked( 7, true ); | 1404 | configureToolBarMenu->setItemChecked( 7, true ); |
1384 | if (p-> mShowIconOnetoolbar) | 1405 | if (p-> mShowIconOnetoolbar) |
1385 | configureToolBarMenu->setItemChecked( 6, true ); | 1406 | configureToolBarMenu->setItemChecked( 6, true ); |
1386 | 1407 | ||
1387 | 1408 | ||
1388 | if ( filterMenubar ) { | 1409 | if ( filterMenubar ) { |
1389 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); | 1410 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); |
1390 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); | 1411 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); |
1391 | } | 1412 | } |
1392 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1413 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1393 | configureAgenda( p->mHourSize ); | 1414 | configureAgenda( p->mHourSize ); |
1394 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1415 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1395 | } | 1416 | } |
1396 | void MainWindow::calHint() | 1417 | void MainWindow::calHint() |
1397 | { | 1418 | { |
1398 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); | 1419 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); |
1399 | 1420 | ||
1400 | KMessageBox::information( this, message); | 1421 | KMessageBox::information( this, message); |
1401 | } | 1422 | } |
1402 | void MainWindow::exportToPhone( int mode ) | 1423 | void MainWindow::exportToPhone( int mode ) |
1403 | { | 1424 | { |
1404 | 1425 | ||
1405 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1426 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1406 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1427 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1407 | KOex2phonePrefs ex2phone; | 1428 | KOex2phonePrefs ex2phone; |
1408 | 1429 | ||
1409 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1430 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1410 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1431 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1411 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1432 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1412 | if ( mode == 1 ) | 1433 | if ( mode == 1 ) |
1413 | ex2phone.setCaption(i18n("Export complete calendar")); | 1434 | ex2phone.setCaption(i18n("Export complete calendar")); |
1414 | if ( mode == 2 ) | 1435 | if ( mode == 2 ) |
1415 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1436 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1416 | 1437 | ||
1417 | if ( !ex2phone.exec() ) { | 1438 | if ( !ex2phone.exec() ) { |
1418 | return; | 1439 | return; |
1419 | } | 1440 | } |
1420 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1441 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1421 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1442 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1422 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1443 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1423 | 1444 | ||
1424 | int inFuture = 0; | 1445 | int inFuture = 0; |
1425 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1446 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1426 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1447 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1427 | QPtrList<Incidence> delSel; | 1448 | QPtrList<Incidence> delSel; |
1428 | if ( mode == 1 ) | 1449 | if ( mode == 1 ) |
1429 | delSel = mCalendar->rawIncidences(); | 1450 | delSel = mCalendar->rawIncidences(); |
1430 | if ( mode == 2 ) | 1451 | if ( mode == 2 ) |
1431 | delSel = mCalendar->incidences(); | 1452 | delSel = mCalendar->incidences(); |
1432 | CalendarLocal* cal = new CalendarLocal(); | 1453 | CalendarLocal* cal = new CalendarLocal(); |
1433 | cal->setLocalTime(); | 1454 | cal->setLocalTime(); |
1434 | Incidence *incidence = delSel.first(); | 1455 | Incidence *incidence = delSel.first(); |
1435 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1456 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1436 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1457 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1437 | while ( incidence ) { | 1458 | while ( incidence ) { |
1438 | if ( incidence->typeID() != journalID ) { | 1459 | if ( incidence->typeID() != journalID ) { |
1439 | bool add = true; | 1460 | bool add = true; |
1440 | if ( inFuture ) { | 1461 | if ( inFuture ) { |
1441 | QDateTime dt; | 1462 | QDateTime dt; |
1442 | if ( incidence->typeID() == todoID ) { | 1463 | if ( incidence->typeID() == todoID ) { |
1443 | Todo * t = (Todo*)incidence; | 1464 | Todo * t = (Todo*)incidence; |
1444 | if ( t->hasDueDate() ) | 1465 | if ( t->hasDueDate() ) |
1445 | dt = t->dtDue(); | 1466 | dt = t->dtDue(); |
1446 | else | 1467 | else |
1447 | dt = cur.addSecs( 62 ); | 1468 | dt = cur.addSecs( 62 ); |
1448 | } | 1469 | } |
1449 | else { | 1470 | else { |
1450 | bool ok; | 1471 | bool ok; |
1451 | dt = incidence->getNextOccurence( cur, &ok ); | 1472 | dt = incidence->getNextOccurence( cur, &ok ); |
1452 | if ( !ok ) | 1473 | if ( !ok ) |
1453 | dt = cur.addSecs( -62 ); | 1474 | dt = cur.addSecs( -62 ); |
1454 | } | 1475 | } |
1455 | if ( dt < cur || dt > end ) { | 1476 | if ( dt < cur || dt > end ) { |
1456 | add = false; | 1477 | add = false; |
1457 | } | 1478 | } |
1458 | } | 1479 | } |
1459 | if ( add ) { | 1480 | if ( add ) { |
1460 | Incidence *in = incidence->clone(); | 1481 | Incidence *in = incidence->clone(); |
1461 | cal->addIncidence( in ); | 1482 | cal->addIncidence( in ); |
1462 | } | 1483 | } |
1463 | } | 1484 | } |
1464 | incidence = delSel.next(); | 1485 | incidence = delSel.next(); |
1465 | } | 1486 | } |
1466 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1487 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1467 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1488 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1468 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1489 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1469 | 1490 | ||
1470 | setCaption( i18n("Writing to phone...")); | 1491 | setCaption( i18n("Writing to phone...")); |
1471 | if ( PhoneFormat::writeToPhone( cal ) ) | 1492 | if ( PhoneFormat::writeToPhone( cal ) ) |
1472 | setCaption( i18n("Export to phone successful!")); | 1493 | setCaption( i18n("Export to phone successful!")); |
1473 | else | 1494 | else |
1474 | setCaption( i18n("Error exporting to phone!")); | 1495 | setCaption( i18n("Error exporting to phone!")); |
1475 | delete cal; | 1496 | delete cal; |
1476 | } | 1497 | } |
1477 | 1498 | ||
1478 | 1499 | ||
1479 | void MainWindow::setDefaultPreferences() | 1500 | void MainWindow::setDefaultPreferences() |
1480 | { | 1501 | { |
1481 | KOPrefs *p = KOPrefs::instance(); | 1502 | KOPrefs *p = KOPrefs::instance(); |
1482 | 1503 | ||
1483 | p->mCompactDialogs = true; | 1504 | p->mCompactDialogs = true; |
1484 | p->mConfirm = true; | 1505 | p->mConfirm = true; |
1485 | // p->mEnableQuickTodo = false; | 1506 | // p->mEnableQuickTodo = false; |
1486 | 1507 | ||
1487 | } | 1508 | } |
1488 | 1509 | ||
1489 | QString MainWindow::resourcePath() | 1510 | QString MainWindow::resourcePath() |
1490 | { | 1511 | { |
1491 | return KGlobal::iconLoader()->iconPath(); | 1512 | return KGlobal::iconLoader()->iconPath(); |
1492 | } | 1513 | } |
1493 | 1514 | ||
1494 | void MainWindow::displayText( QString text ,QString cap ) | 1515 | void MainWindow::displayText( QString text ,QString cap ) |
1495 | { | 1516 | { |
1496 | QDialog dia( this, "name", true ); ; | 1517 | QDialog dia( this, "name", true ); ; |
1497 | dia.setCaption( cap ); | 1518 | dia.setCaption( cap ); |
1498 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1519 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1499 | lay->setSpacing( 3 ); | 1520 | lay->setSpacing( 3 ); |
1500 | lay->setMargin( 3 ); | 1521 | lay->setMargin( 3 ); |
1501 | QTextBrowser tb ( &dia ); | 1522 | QTextBrowser tb ( &dia ); |
1502 | lay->addWidget( &tb ); | 1523 | lay->addWidget( &tb ); |
1503 | tb.setText( text ); | 1524 | tb.setText( text ); |
1504 | #ifdef DESKTOP_VERSION | 1525 | #ifdef DESKTOP_VERSION |
1505 | dia.resize( 640, 480); | 1526 | dia.resize( 640, 480); |
1506 | #else | 1527 | #else |
1507 | dia.showMaximized(); | 1528 | dia.showMaximized(); |
1508 | #endif | 1529 | #endif |
1509 | dia.exec(); | 1530 | dia.exec(); |
1510 | } | 1531 | } |
1511 | 1532 | ||
1512 | void MainWindow::features() | 1533 | void MainWindow::features() |
1513 | { | 1534 | { |
1514 | 1535 | ||
1515 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1536 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1516 | } | 1537 | } |
1517 | 1538 | ||
1518 | void MainWindow::usertrans() | 1539 | void MainWindow::usertrans() |
1519 | { | 1540 | { |
1520 | 1541 | ||
1521 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1542 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1522 | } | 1543 | } |
1523 | 1544 | ||
1524 | void MainWindow::storagehowto() | 1545 | void MainWindow::storagehowto() |
1525 | { | 1546 | { |
1526 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1547 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1527 | } | 1548 | } |
1528 | void MainWindow::timetrackinghowto() | 1549 | void MainWindow::timetrackinghowto() |
1529 | { | 1550 | { |
1530 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1551 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1531 | } | 1552 | } |
1532 | void MainWindow::kdesynchowto() | 1553 | void MainWindow::kdesynchowto() |
1533 | { | 1554 | { |
1534 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1555 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1535 | } | 1556 | } |
1536 | void MainWindow::multisynchowto() | 1557 | void MainWindow::multisynchowto() |
1537 | { | 1558 | { |
1538 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1559 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1539 | } | 1560 | } |
1540 | void MainWindow::synchowto() | 1561 | void MainWindow::synchowto() |
1541 | { | 1562 | { |
1542 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1563 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1543 | } | 1564 | } |
1544 | void MainWindow::faq() | 1565 | void MainWindow::faq() |
1545 | { | 1566 | { |
1546 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1567 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1547 | 1568 | ||
1548 | } | 1569 | } |
1549 | void MainWindow::whatsNew() | 1570 | void MainWindow::whatsNew() |
1550 | { | 1571 | { |
1551 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1572 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1552 | 1573 | ||
1553 | } | 1574 | } |
1554 | void MainWindow::licence() | 1575 | void MainWindow::licence() |
1555 | { | 1576 | { |
1556 | KApplication::showLicence(); | 1577 | KApplication::showLicence(); |
1557 | 1578 | ||
1558 | } | 1579 | } |
1559 | void MainWindow::about() | 1580 | void MainWindow::about() |
1560 | { | 1581 | { |
1561 | QString version; | 1582 | QString version; |
1562 | #include <../version> | 1583 | #include <../version> |
1563 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1584 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1564 | i18n("KOrganizer/Platform-independent\n") + | 1585 | i18n("KOrganizer/Platform-independent\n") + |
1565 | "(KO/Pi) " + version + " - " + | 1586 | "(KO/Pi) " + version + " - " + |
1566 | 1587 | ||
1567 | #ifdef DESKTOP_VERSION | 1588 | #ifdef DESKTOP_VERSION |
1568 | i18n("Desktop Edition\n") + | 1589 | i18n("Desktop Edition\n") + |
1569 | #else | 1590 | #else |
1570 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1591 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1571 | #endif | 1592 | #endif |
1572 | 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.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1593 | 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.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1573 | } | 1594 | } |
1574 | void MainWindow::keyBindings() | 1595 | void MainWindow::keyBindings() |
1575 | { | 1596 | { |
1576 | QString cap = i18n("KO/Pi Keys + Colors"); | 1597 | QString cap = i18n("KO/Pi Keys + Colors"); |
1577 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1598 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1578 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1599 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1579 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1600 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1580 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1601 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1581 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1602 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1582 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1603 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1583 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1604 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1584 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1605 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1585 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1606 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1586 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1607 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1587 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ | 1608 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ |
1588 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1609 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1589 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1610 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1590 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1611 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1591 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1612 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1592 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1613 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1593 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1614 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1594 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1615 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1595 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1616 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1596 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1617 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1597 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1618 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1598 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1619 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1599 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1620 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1600 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1621 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1601 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1622 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1602 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1623 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1603 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1624 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1604 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1625 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1605 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1626 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1606 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1627 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1607 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1628 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1608 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1629 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1609 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1630 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1610 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1631 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1611 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1632 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1612 | i18n("<p><h3>In list view:</h3></p>\n") + | 1633 | i18n("<p><h3>In list view:</h3></p>\n") + |
1613 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1634 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1614 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1635 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1615 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1636 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1616 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1637 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1617 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1638 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1618 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1639 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1619 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1640 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1620 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1641 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1621 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1642 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1622 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1643 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1623 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1644 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1624 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1645 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1625 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1646 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1626 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1647 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1627 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1648 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1628 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1649 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1629 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1650 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1630 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1651 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1631 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1652 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1632 | displayText( text, cap); | 1653 | displayText( text, cap); |
1633 | } | 1654 | } |
1634 | void MainWindow::aboutAutoSaving() | 1655 | void MainWindow::aboutAutoSaving() |
1635 | { | 1656 | { |
1636 | 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"); | 1657 | 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"); |
1637 | 1658 | ||
1638 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1659 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1639 | 1660 | ||
1640 | } | 1661 | } |
1641 | void MainWindow::aboutKnownBugs() | 1662 | void MainWindow::aboutKnownBugs() |
1642 | { | 1663 | { |
1643 | QMessageBox* msg; | 1664 | QMessageBox* msg; |
1644 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1665 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1645 | 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")+ | 1666 | 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")+ |
1646 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1667 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1647 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1668 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1648 | i18n("\nor report them in the bugtracker on\n") + | 1669 | i18n("\nor report them in the bugtracker on\n") + |
1649 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1670 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1650 | QMessageBox::NoIcon, | 1671 | QMessageBox::NoIcon, |
1651 | QMessageBox::Ok, | 1672 | QMessageBox::Ok, |
1652 | QMessageBox::NoButton, | 1673 | QMessageBox::NoButton, |
1653 | QMessageBox::NoButton); | 1674 | QMessageBox::NoButton); |
1654 | msg->exec(); | 1675 | msg->exec(); |
1655 | delete msg; | 1676 | delete msg; |
1656 | 1677 | ||
1657 | } | 1678 | } |
1658 | 1679 | ||
1659 | QString MainWindow::defaultFileName() | 1680 | QString MainWindow::defaultFileName() |
1660 | { | 1681 | { |
1661 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1682 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1662 | } | 1683 | } |
1663 | QString MainWindow::syncFileName() | 1684 | QString MainWindow::syncFileName() |
1664 | { | 1685 | { |
1665 | #ifdef DESKTOP_VERSION | 1686 | #ifdef DESKTOP_VERSION |
1666 | return locateLocal( "tmp", "synccalendar.ics" ); | 1687 | return locateLocal( "tmp", "synccalendar.ics" ); |
1667 | #else | 1688 | #else |
1668 | return QString( "/tmp/synccalendar.ics" ); | 1689 | return QString( "/tmp/synccalendar.ics" ); |
1669 | #endif | 1690 | #endif |
1670 | } | 1691 | } |
1671 | #include "koglobals.h" | 1692 | #include "koglobals.h" |
1672 | #include <kcalendarsystem.h> | 1693 | #include <kcalendarsystem.h> |
1673 | void MainWindow::updateWeek(QDate seda) | 1694 | void MainWindow::updateWeek(QDate seda) |
1674 | { | 1695 | { |
1675 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1696 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1676 | mWeekPixmap.fill( mWeekBgColor ); | 1697 | mWeekPixmap.fill( mWeekBgColor ); |
1677 | QPainter p ( &mWeekPixmap ); | 1698 | QPainter p ( &mWeekPixmap ); |
1678 | p.setFont( mWeekFont ); | 1699 | p.setFont( mWeekFont ); |
1679 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1700 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1680 | p.end(); | 1701 | p.end(); |
1681 | QIconSet icon3 ( mWeekPixmap ); | 1702 | QIconSet icon3 ( mWeekPixmap ); |
1682 | mWeekAction->setIconSet ( icon3 ); | 1703 | mWeekAction->setIconSet ( icon3 ); |
1683 | 1704 | ||
1684 | } | 1705 | } |
1685 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1706 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1686 | { | 1707 | { |
1687 | updateWeek( selectedDates.first() ); | 1708 | updateWeek( selectedDates.first() ); |
1688 | } | 1709 | } |
1689 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1710 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1690 | { | 1711 | { |
1691 | if ( !incidence ) { | 1712 | if ( !incidence ) { |
1692 | mShowAction->setMenuText( i18n("Show") ); | 1713 | mShowAction->setMenuText( i18n("Show") ); |
1693 | enableIncidenceActions( false ); | 1714 | enableIncidenceActions( false ); |
1694 | mNewSubTodoAction->setEnabled( false ); | 1715 | mNewSubTodoAction->setEnabled( false ); |
1695 | setCaptionToDates(); | 1716 | setCaptionToDates(); |
1696 | return; | 1717 | return; |
1697 | } | 1718 | } |
1698 | QString startString = ""; | 1719 | QString startString = ""; |
1699 | if ( incidence->typeID() != todoID ) { | 1720 | if ( incidence->typeID() != todoID ) { |
1700 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1721 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1701 | if ( incidence->doesFloat() ) { | 1722 | if ( incidence->doesFloat() ) { |
1702 | startString += ": "+incidence->dtStartDateStr( true ); | 1723 | startString += ": "+incidence->dtStartDateStr( true ); |
1703 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1724 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1704 | } else { | 1725 | } else { |
1705 | startString = ": "+incidence->dtStartStr(true); | 1726 | startString = ": "+incidence->dtStartStr(true); |
1706 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1727 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1707 | } | 1728 | } |
1708 | } else { | 1729 | } else { |
1709 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1730 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1710 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1731 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1711 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1732 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1712 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1733 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1713 | bool ok; | 1734 | bool ok; |
1714 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1735 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1715 | if ( ok ) { | 1736 | if ( ok ) { |
1716 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1737 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1717 | startString += i18n(" (%1 y.)"). arg( years ); | 1738 | startString += i18n(" (%1 y.)"). arg( years ); |
1718 | } | 1739 | } |
1719 | } | 1740 | } |
1720 | else | 1741 | else |
1721 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1742 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1722 | } | 1743 | } |
1723 | } | 1744 | } |
1724 | else { | 1745 | else { |
1725 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) | 1746 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1726 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | 1747 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); |
1727 | else | 1748 | else |
1728 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1749 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1729 | } | 1750 | } |
1730 | if ( !incidence->location().isEmpty() ) | 1751 | if ( !incidence->location().isEmpty() ) |
1731 | startString += " (" +incidence->location()+")"; | 1752 | startString += " (" +incidence->location()+")"; |
1732 | setCaption( incidence->summary()+startString); | 1753 | setCaption( incidence->summary()+startString); |
1733 | enableIncidenceActions( true ); | 1754 | enableIncidenceActions( true ); |
1734 | if ( incidence->typeID() == eventID ) { | 1755 | if ( incidence->typeID() == eventID ) { |
1735 | mShowAction->setMenuText( i18n("Show Event") ); | 1756 | mShowAction->setMenuText( i18n("Show Event") ); |
1736 | mNewSubTodoAction->setEnabled( false ); | 1757 | mNewSubTodoAction->setEnabled( false ); |
1737 | } else if ( incidence->typeID() == todoID ) { | 1758 | } else if ( incidence->typeID() == todoID ) { |
1738 | mShowAction->setMenuText( i18n("Show Todo") ); | 1759 | mShowAction->setMenuText( i18n("Show Todo") ); |
1739 | mNewSubTodoAction->setEnabled( true ); | 1760 | mNewSubTodoAction->setEnabled( true ); |
1740 | } else { | 1761 | } else { |
1741 | mShowAction->setMenuText( i18n("Show") ); | 1762 | mShowAction->setMenuText( i18n("Show") ); |
1742 | mNewSubTodoAction->setEnabled( false ); | 1763 | mNewSubTodoAction->setEnabled( false ); |
1743 | } | 1764 | } |
1744 | static QPixmap jP = SmallIcon( "journal" ); | 1765 | static QPixmap jP = SmallIcon( "journal" ); |
1745 | static QPixmap eP = SmallIcon( "newevent" ); | 1766 | static QPixmap eP = SmallIcon( "newevent" ); |
1746 | static QPixmap tP = SmallIcon( "newtodo" ); | 1767 | static QPixmap tP = SmallIcon( "newtodo" ); |
1747 | #ifdef DESKTOP_VERSION | 1768 | #ifdef DESKTOP_VERSION |
1748 | QIconSet icon; | 1769 | QIconSet icon; |
1749 | if ( incidence->typeID() == todoID ) | 1770 | if ( incidence->typeID() == todoID ) |
1750 | icon = QIconSet ( tP ); | 1771 | icon = QIconSet ( tP ); |
1751 | else if ( incidence->typeID() == eventID ) | 1772 | else if ( incidence->typeID() == eventID ) |
1752 | icon = QIconSet ( eP ); | 1773 | icon = QIconSet ( eP ); |
1753 | else if ( incidence->typeID() == journalID ) | 1774 | else if ( incidence->typeID() == journalID ) |
1754 | icon = QIconSet ( jP ); | 1775 | icon = QIconSet ( jP ); |
1755 | mPrintSelAction->setIconSet ( icon ); | 1776 | mPrintSelAction->setIconSet ( icon ); |
1756 | #endif | 1777 | #endif |
1757 | } | 1778 | } |
1758 | 1779 | ||
1759 | void MainWindow::enableIncidenceActions( bool enabled ) | 1780 | void MainWindow::enableIncidenceActions( bool enabled ) |
1760 | { | 1781 | { |
1761 | mShowAction->setEnabled( enabled ); | 1782 | mShowAction->setEnabled( enabled ); |
1762 | mEditAction->setEnabled( enabled ); | 1783 | mEditAction->setEnabled( enabled ); |
1763 | mDeleteAction->setEnabled( enabled ); | 1784 | mDeleteAction->setEnabled( enabled ); |
1764 | 1785 | ||
1765 | mCloneAction->setEnabled( enabled ); | 1786 | mCloneAction->setEnabled( enabled ); |
1766 | mMoveAction->setEnabled( enabled ); | 1787 | mMoveAction->setEnabled( enabled ); |
1767 | #ifndef DESKTOP_VERSION | 1788 | #ifndef DESKTOP_VERSION |
1768 | mBeamAction->setEnabled( enabled ); | 1789 | mBeamAction->setEnabled( enabled ); |
1769 | #else | 1790 | #else |
1770 | mPrintSelAction->setEnabled( enabled ); | 1791 | mPrintSelAction->setEnabled( enabled ); |
1771 | #endif | 1792 | #endif |
1772 | mCancelAction->setEnabled( enabled ); | 1793 | mCancelAction->setEnabled( enabled ); |
1773 | } | 1794 | } |
1774 | 1795 | ||
1775 | void MainWindow::importOL() | 1796 | void MainWindow::importOL() |
1776 | { | 1797 | { |
1777 | #ifdef _OL_IMPORT_ | 1798 | #ifdef _OL_IMPORT_ |
1778 | mView->clearAllViews(); | 1799 | mView->clearAllViews(); |
1779 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1800 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1780 | id->exec(); | 1801 | id->exec(); |
1781 | delete id; | 1802 | delete id; |
1782 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1803 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1783 | mView->updateView(); | 1804 | mView->updateView(); |
1784 | #endif | 1805 | #endif |
1785 | } | 1806 | } |
1786 | void MainWindow::importBday() | 1807 | void MainWindow::importBday() |
1787 | { | 1808 | { |
1788 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1809 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1789 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1810 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1790 | i18n("Import!"), i18n("Cancel"), 0, | 1811 | i18n("Import!"), i18n("Cancel"), 0, |
1791 | 0, 1 ); | 1812 | 0, 1 ); |
1792 | if ( result == 0 ) { | 1813 | if ( result == 0 ) { |
1793 | mView->importBday(); | 1814 | mView->importBday(); |
1794 | 1815 | ||
1795 | } | 1816 | } |
1796 | 1817 | ||
1797 | 1818 | ||
1798 | } | 1819 | } |
1799 | void MainWindow::importQtopia() | 1820 | void MainWindow::importQtopia() |
1800 | { | 1821 | { |
1801 | //#ifndef DESKTOP_VERSION | 1822 | //#ifndef DESKTOP_VERSION |
1802 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1823 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1803 | #ifdef DESKTOP_VERSION | 1824 | #ifdef DESKTOP_VERSION |
1804 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1825 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1805 | #endif | 1826 | #endif |
1806 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1827 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1807 | i18n("Import!"), i18n("Cancel"), 0, | 1828 | i18n("Import!"), i18n("Cancel"), 0, |
1808 | 0, 1 ); | 1829 | 0, 1 ); |
1809 | if ( result == 0 ) { | 1830 | if ( result == 0 ) { |
1810 | #ifndef DESKTOP_VERSION | 1831 | #ifndef DESKTOP_VERSION |
1811 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1832 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1812 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1833 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1813 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1834 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1814 | #else | 1835 | #else |
1815 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1836 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1816 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1837 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1817 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1838 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1818 | #endif | 1839 | #endif |
1819 | mView->importQtopia( categories, datebook, todolist ); | 1840 | mView->importQtopia( categories, datebook, todolist ); |
1820 | } | 1841 | } |
1821 | mView->calendar()->reInitAlarmSettings(); | 1842 | mView->calendar()->reInitAlarmSettings(); |
1822 | #if 0 | 1843 | #if 0 |
1823 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1844 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1824 | i18n("Not supported \non desktop!\n"), | 1845 | i18n("Not supported \non desktop!\n"), |
1825 | i18n("Ok"), i18n("Cancel"), 0, | 1846 | i18n("Ok"), i18n("Cancel"), 0, |
1826 | 0, 1 ); | 1847 | 0, 1 ); |
1827 | 1848 | ||
1828 | #endif | 1849 | #endif |
1829 | } | 1850 | } |
1830 | 1851 | ||
1831 | void MainWindow::saveOnClose() | 1852 | void MainWindow::saveOnClose() |
1832 | { | 1853 | { |
1833 | KOPrefs *p = KOPrefs::instance(); | 1854 | KOPrefs *p = KOPrefs::instance(); |
1834 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1855 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1835 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1856 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1836 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1857 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1837 | if ( filterToolBar ) { | 1858 | if ( filterToolBar ) { |
1838 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1859 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1839 | } | 1860 | } |
1840 | #ifdef DESKTOP_VERSION | 1861 | #ifdef DESKTOP_VERSION |
1841 | 1862 | ||
1842 | QPoint myP; | 1863 | QPoint myP; |
1843 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1864 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1844 | if ( p->mToolBarHor ) | 1865 | if ( p->mToolBarHor ) |
1845 | p->mToolBarUp = myP.y() > height()/2; | 1866 | p->mToolBarUp = myP.y() > height()/2; |
1846 | else | 1867 | else |
1847 | p->mToolBarUp = myP.x() > width()/2; | 1868 | p->mToolBarUp = myP.x() > width()/2; |
1848 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1869 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1849 | if ( p->mToolBarHorV ) | 1870 | if ( p->mToolBarHorV ) |
1850 | p->mToolBarUpV = myP.y() > height()/2; | 1871 | p->mToolBarUpV = myP.y() > height()/2; |
1851 | else | 1872 | else |
1852 | p->mToolBarUpV = myP.x() > width()/2 ; | 1873 | p->mToolBarUpV = myP.x() > width()/2 ; |
1853 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1874 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1854 | if ( p->mToolBarHorN ) | 1875 | if ( p->mToolBarHorN ) |
1855 | p->mToolBarUpN = myP.y() > height()/2; | 1876 | p->mToolBarUpN = myP.y() > height()/2; |
1856 | else | 1877 | else |
1857 | p->mToolBarUpN = myP.x() > width()/2 ; | 1878 | p->mToolBarUpN = myP.x() > width()/2 ; |
1858 | if ( filterToolBar ) { | 1879 | if ( filterToolBar ) { |
1859 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1880 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1860 | if ( p->mToolBarHorF ) | 1881 | if ( p->mToolBarHorF ) |
1861 | p->mToolBarUpF = myP.y() > height()/2; | 1882 | p->mToolBarUpF = myP.y() > height()/2; |
1862 | else | 1883 | else |
1863 | p->mToolBarUpF = myP.x() > width()/2 ; | 1884 | p->mToolBarUpF = myP.x() > width()/2 ; |
1864 | } | 1885 | } |
1865 | #else | 1886 | #else |
1866 | if ( p->mToolBarHor ) | 1887 | if ( p->mToolBarHor ) |
1867 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1888 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1868 | else | 1889 | else |
1869 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1890 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1870 | if ( p->mToolBarHorV ) | 1891 | if ( p->mToolBarHorV ) |
1871 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1892 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1872 | else | 1893 | else |
1873 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1894 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1874 | 1895 | ||
1875 | if ( p->mToolBarHorN ) | 1896 | if ( p->mToolBarHorN ) |
1876 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1897 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1877 | else | 1898 | else |
1878 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1899 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1879 | if ( filterToolBar ) { | 1900 | if ( filterToolBar ) { |
1880 | if ( p->mToolBarHorF ) | 1901 | if ( p->mToolBarHorF ) |
1881 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1902 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1882 | else | 1903 | else |
1883 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1904 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1884 | } | 1905 | } |
1885 | #endif | 1906 | #endif |
1886 | save(); | 1907 | save(); |
1887 | mView->writeSettings(); | 1908 | mView->writeSettings(); |
1888 | mView->checkSuspendAlarm(); | 1909 | mView->checkSuspendAlarm(); |
1889 | } | 1910 | } |
1890 | void MainWindow::slotModifiedChanged( bool ) | 1911 | void MainWindow::slotModifiedChanged( bool ) |
1891 | { | 1912 | { |
1892 | if ( mBlockAtStartup ) | 1913 | if ( mBlockAtStartup ) |
1893 | return; | 1914 | return; |
1894 | 1915 | ||
1895 | int msec; | 1916 | int msec; |
1896 | // we store the changes after 1 minute, | 1917 | // we store the changes after 1 minute, |
1897 | // and for safety reasons after 10 minutes again | 1918 | // and for safety reasons after 10 minutes again |
1898 | if ( !mSyncManager->blockSave() ) | 1919 | if ( !mSyncManager->blockSave() ) |
1899 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1920 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1900 | else | 1921 | else |
1901 | msec = 1000 * 600; | 1922 | msec = 1000 * 600; |
1902 | mSaveTimer.start( msec, true ); // 1 minute | 1923 | mSaveTimer.start( msec, true ); // 1 minute |
1903 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1924 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1904 | mCalendarModifiedFlag = true; | 1925 | mCalendarModifiedFlag = true; |
1905 | } | 1926 | } |
1906 | void MainWindow::saveStopTimer() | 1927 | void MainWindow::saveStopTimer() |
1907 | { | 1928 | { |
1908 | mSaveTimer.stop(); | 1929 | mSaveTimer.stop(); |
1909 | } | 1930 | } |
1910 | void MainWindow::backupAllFiles() | 1931 | void MainWindow::backupAllFiles() |
1911 | { | 1932 | { |
1912 | QDate reference ( 2000,1,1); | 1933 | QDate reference ( 2000,1,1); |
1913 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1934 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1914 | setCaption(i18n("Creating backup ... please wait ..." )); | 1935 | setCaption(i18n("Creating backup ... please wait ..." )); |
1915 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1936 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1916 | // we need the file path, the backup dir and the number of bups as param | 1937 | // we need the file path, the backup dir and the number of bups as param |
1917 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1938 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1918 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1939 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1919 | bupDir = KGlobalSettings::backupDataDir(); | 1940 | bupDir = KGlobalSettings::backupDataDir(); |
1920 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1941 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1921 | if ( retval == 0 ) { | 1942 | if ( retval == 0 ) { |
1922 | setCaption(i18n("Backup cancelled" )); | 1943 | setCaption(i18n("Backup cancelled" )); |
1923 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1944 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1924 | // retval == 0 : backup skipped for today, try again tomorrow | 1945 | // retval == 0 : backup skipped for today, try again tomorrow |
1925 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1946 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1926 | } else if ( retval == 1 ){ | 1947 | } else if ( retval == 1 ){ |
1927 | qDebug("KO: Backup created."); | 1948 | qDebug("KO: Backup created."); |
1928 | // backup ok | 1949 | // backup ok |
1929 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1950 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1930 | KopiCalendarFile * cal = calendars.first(); | 1951 | KopiCalendarFile * cal = calendars.first(); |
1931 | cal = calendars.next(); | 1952 | cal = calendars.next(); |
1932 | while ( cal ) { | 1953 | while ( cal ) { |
1933 | if ( !cal->mErrorOnLoad ) { | 1954 | if ( !cal->mErrorOnLoad ) { |
1934 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1955 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1935 | } | 1956 | } |
1936 | cal = calendars.next(); | 1957 | cal = calendars.next(); |
1937 | } | 1958 | } |
1938 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1959 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1939 | setCaption(i18n("Backup succesfully finished" )); | 1960 | setCaption(i18n("Backup succesfully finished" )); |
1940 | } else if ( retval == 2 ){ | 1961 | } else if ( retval == 2 ){ |
1941 | setCaption(i18n("Backup globally disabled" )); | 1962 | setCaption(i18n("Backup globally disabled" )); |
1942 | qDebug("KO: Backup globally cancelled."); | 1963 | qDebug("KO: Backup globally cancelled."); |
1943 | // backup globally cancelled | 1964 | // backup globally cancelled |
1944 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1965 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1945 | } | 1966 | } |
1946 | // retval == 3: do nothing, try again later | 1967 | // retval == 3: do nothing, try again later |
1947 | } | 1968 | } |
1948 | void MainWindow::save() | 1969 | void MainWindow::save() |
1949 | { | 1970 | { |
1950 | 1971 | ||
1951 | if ( mView->viewManager()->journalView() ) | 1972 | if ( mView->viewManager()->journalView() ) |
1952 | mView->viewManager()->journalView()->checkModified(); | 1973 | mView->viewManager()->journalView()->checkModified(); |
1953 | if ( !mCalendarModifiedFlag ) { | 1974 | if ( !mCalendarModifiedFlag ) { |
1954 | qDebug("KO: Calendar not modified. Nothing saved."); | 1975 | qDebug("KO: Calendar not modified. Nothing saved."); |
1955 | return; | 1976 | return; |
1956 | } | 1977 | } |
1957 | if ( mSyncManager->blockSave() ) | 1978 | if ( mSyncManager->blockSave() ) |
1958 | return; | 1979 | return; |
1959 | mSyncManager->setBlockSave(true); | 1980 | mSyncManager->setBlockSave(true); |
1960 | if ( mView->checkAllFileVersions() ) { | 1981 | if ( mView->checkAllFileVersions() ) { |
1961 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1982 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1962 | QDate reference ( 2000,1,1); | 1983 | QDate reference ( 2000,1,1); |
1963 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1984 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1964 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1985 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1965 | backupAllFiles(); | 1986 | backupAllFiles(); |
1966 | } | 1987 | } |
1967 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1988 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1968 | } | 1989 | } |
1969 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1990 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1970 | if ( !isMinimized () ) | 1991 | if ( !isMinimized () ) |
1971 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1992 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1972 | qDebug("KO: Start saving data to file!"); | 1993 | qDebug("KO: Start saving data to file!"); |
1973 | mView->saveCalendars(); | 1994 | mView->saveCalendars(); |
1974 | mCalendarModifiedFlag = false; | 1995 | mCalendarModifiedFlag = false; |
1975 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1996 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1976 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1997 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1977 | QString savemes; | 1998 | QString savemes; |
1978 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1999 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1979 | if ( !isMinimized () ) | 2000 | if ( !isMinimized () ) |
1980 | setCaption(savemes); | 2001 | setCaption(savemes); |
1981 | else | 2002 | else |
1982 | qDebug(savemes); | 2003 | qDebug(savemes); |
1983 | } else | 2004 | } else |
1984 | setCaption(i18n("Saving cancelled!")); | 2005 | setCaption(i18n("Saving cancelled!")); |
1985 | mSyncManager->setBlockSave( false ); | 2006 | mSyncManager->setBlockSave( false ); |
1986 | } | 2007 | } |
1987 | 2008 | ||
1988 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2009 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1989 | { | 2010 | { |
1990 | if ( !e->isAutoRepeat() ) { | 2011 | if ( !e->isAutoRepeat() ) { |
1991 | mFlagKeyPressed = false; | 2012 | mFlagKeyPressed = false; |
1992 | } | 2013 | } |
1993 | } | 2014 | } |
1994 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2015 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1995 | { | 2016 | { |
1996 | qApp->processEvents(); | 2017 | qApp->processEvents(); |
1997 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2018 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1998 | e->ignore(); | 2019 | e->ignore(); |
1999 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 2020 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2000 | return; | 2021 | return; |
2001 | } | 2022 | } |
2002 | if (! e->isAutoRepeat() ) | 2023 | if (! e->isAutoRepeat() ) |
2003 | mFlagKeyPressed = true; | 2024 | mFlagKeyPressed = true; |
2004 | KOPrefs *p = KOPrefs::instance(); | 2025 | KOPrefs *p = KOPrefs::instance(); |
2005 | bool showSelectedDates = false; | 2026 | bool showSelectedDates = false; |
2006 | int size; | 2027 | int size; |
2007 | int pro = 0; | 2028 | int pro = 0; |
2008 | //qDebug("MainWindow::keyPressEvent "); | 2029 | //qDebug("MainWindow::keyPressEvent "); |
2009 | switch ( e->key() ) { | 2030 | switch ( e->key() ) { |
2010 | case Qt::Key_Right: | 2031 | case Qt::Key_Right: |
2011 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2032 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2012 | mView->goNextMonth(); | 2033 | mView->goNextMonth(); |
2013 | else | 2034 | else |
2014 | mView->goNext(); | 2035 | mView->goNext(); |
2015 | showSelectedDates = true; | 2036 | showSelectedDates = true; |
2016 | break; | 2037 | break; |
2017 | case Qt::Key_Left: | 2038 | case Qt::Key_Left: |
2018 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2039 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2019 | mView->goPreviousMonth(); | 2040 | mView->goPreviousMonth(); |
2020 | else | 2041 | else |
2021 | mView->goPrevious(); | 2042 | mView->goPrevious(); |
2022 | showSelectedDates = true; | 2043 | showSelectedDates = true; |
2023 | break; | 2044 | break; |
2024 | case Qt::Key_Down: | 2045 | case Qt::Key_Down: |
2025 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2046 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2026 | break; | 2047 | break; |
2027 | case Qt::Key_Up: | 2048 | case Qt::Key_Up: |
2028 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2049 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2029 | break; | 2050 | break; |
2030 | case Qt::Key_K: | 2051 | case Qt::Key_K: |
2031 | mView->viewManager()->showMonthViewWeek(); | 2052 | mView->viewManager()->showMonthViewWeek(); |
2032 | break; | 2053 | break; |
2033 | case Qt::Key_I: | 2054 | case Qt::Key_I: |
2034 | mView->showIncidence(); | 2055 | mView->showIncidence(); |
2035 | break; | 2056 | break; |
2036 | case Qt::Key_Delete: | 2057 | case Qt::Key_Delete: |
2037 | case Qt::Key_Backspace: | 2058 | case Qt::Key_Backspace: |
2038 | mView->deleteIncidence(); | 2059 | mView->deleteIncidence(); |
2039 | break; | 2060 | break; |
2040 | case Qt::Key_D: | 2061 | case Qt::Key_D: |
2041 | mView->viewManager()->showDayView(); | 2062 | mView->viewManager()->showDayView(); |
2042 | showSelectedDates = true; | 2063 | showSelectedDates = true; |
2043 | break; | 2064 | break; |
2044 | case Qt::Key_O: | 2065 | case Qt::Key_O: |
2045 | mView->toggleFilerEnabled( ); | 2066 | mView->toggleFilerEnabled( ); |
2046 | break; | 2067 | break; |
2047 | case Qt::Key_0: | 2068 | case Qt::Key_0: |
2048 | case Qt::Key_1: | 2069 | case Qt::Key_1: |
2049 | case Qt::Key_2: | 2070 | case Qt::Key_2: |
2050 | case Qt::Key_3: | 2071 | case Qt::Key_3: |
2051 | case Qt::Key_4: | 2072 | case Qt::Key_4: |
2052 | case Qt::Key_5: | 2073 | case Qt::Key_5: |
2053 | case Qt::Key_6: | 2074 | case Qt::Key_6: |
2054 | case Qt::Key_7: | 2075 | case Qt::Key_7: |
2055 | case Qt::Key_8: | 2076 | case Qt::Key_8: |
2056 | case Qt::Key_9: | 2077 | case Qt::Key_9: |
2057 | pro = e->key()-48; | 2078 | pro = e->key()-48; |
2058 | if ( pro == 0 ) | 2079 | if ( pro == 0 ) |
2059 | pro = 10; | 2080 | pro = 10; |
2060 | if ( e->state() == Qt::ControlButton) | 2081 | if ( e->state() == Qt::ControlButton) |
2061 | pro += 10; | 2082 | pro += 10; |
2062 | break; | 2083 | break; |
2063 | case Qt::Key_M: | 2084 | case Qt::Key_M: |
2064 | mView->viewManager()->showMonthView(); | 2085 | mView->viewManager()->showMonthView(); |
2065 | showSelectedDates = true; | 2086 | showSelectedDates = true; |
2066 | break; | 2087 | break; |
2067 | case Qt::Key_Insert: | 2088 | case Qt::Key_Insert: |
2068 | mView->newEvent(); | 2089 | mView->newEvent(); |
2069 | break; | 2090 | break; |
2070 | case Qt::Key_S : | 2091 | case Qt::Key_S : |
2071 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2092 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2072 | mView->newSubTodo(); | 2093 | mView->newSubTodo(); |
2073 | else | 2094 | else |
2074 | mView->dialogManager()->showSearchDialog(); | 2095 | mView->dialogManager()->showSearchDialog(); |
2075 | break; | 2096 | break; |
2076 | case Qt::Key_Y : | 2097 | case Qt::Key_Y : |
2077 | case Qt::Key_Z : | 2098 | case Qt::Key_Z : |
2078 | mView->viewManager()->showWorkWeekView(); | 2099 | mView->viewManager()->showWorkWeekView(); |
2079 | showSelectedDates = true; | 2100 | showSelectedDates = true; |
2080 | break; | 2101 | break; |
2081 | case Qt::Key_U : | 2102 | case Qt::Key_U : |
2082 | mView->viewManager()->showWeekView(); | 2103 | mView->viewManager()->showWeekView(); |
2083 | showSelectedDates = true; | 2104 | showSelectedDates = true; |
2084 | break; | 2105 | break; |
2085 | case Qt::Key_H : | 2106 | case Qt::Key_H : |
2086 | keyBindings(); | 2107 | keyBindings(); |
2087 | break; | 2108 | break; |
2088 | case Qt::Key_W: | 2109 | case Qt::Key_W: |
2089 | mView->viewManager()->showWhatsNextView(); | 2110 | mView->viewManager()->showWhatsNextView(); |
2090 | break; | 2111 | break; |
2091 | case Qt::Key_L: | 2112 | case Qt::Key_L: |
2092 | mView->viewManager()->showListView(); | 2113 | mView->viewManager()->showListView(); |
2093 | break; | 2114 | break; |
2094 | case Qt::Key_N: | 2115 | case Qt::Key_N: |
2095 | mView->viewManager()->showNextView(); | 2116 | mView->viewManager()->showNextView(); |
2096 | break; | 2117 | break; |
2097 | case Qt::Key_V: | 2118 | case Qt::Key_V: |
2098 | mView->viewManager()->showTodoView(); | 2119 | mView->viewManager()->showTodoView(); |
2099 | break; | 2120 | break; |
2100 | case Qt::Key_C: | 2121 | case Qt::Key_C: |
2101 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2122 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
2102 | break; | 2123 | break; |
2103 | case Qt::Key_P: | 2124 | case Qt::Key_P: |
2104 | mView->showDatePicker( ); | 2125 | mView->showDatePicker( ); |
2105 | break; | 2126 | break; |
2106 | case Qt::Key_F: | 2127 | case Qt::Key_F: |
2107 | mView->editFilters(); | 2128 | mView->editFilters(); |
2108 | break; | 2129 | break; |
2109 | case Qt::Key_R: | 2130 | case Qt::Key_R: |
2110 | mView->toggleFilter(); | 2131 | mView->toggleFilter(); |
2111 | break; | 2132 | break; |
2112 | case Qt::Key_X: | 2133 | case Qt::Key_X: |
2113 | if ( e->state() == Qt::ControlButton ) | 2134 | if ( e->state() == Qt::ControlButton ) |
2114 | mView->toggleDateNavigatorWidget(); | 2135 | mView->toggleDateNavigatorWidget(); |
2115 | else { | 2136 | else { |
2116 | mView->viewManager()->showNextXView(); | 2137 | mView->viewManager()->showNextXView(); |
2117 | showSelectedDates = true; | 2138 | showSelectedDates = true; |
2118 | } | 2139 | } |
2119 | break; | 2140 | break; |
2120 | case Qt::Key_Space: | 2141 | case Qt::Key_Space: |
2121 | mView->toggleExpand(); | 2142 | mView->toggleExpand(); |
2122 | break; | 2143 | break; |
2123 | case Qt::Key_A: | 2144 | case Qt::Key_A: |
2124 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2145 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2125 | mView->showNextAlarms(); | 2146 | mView->showNextAlarms(); |
2126 | else | 2147 | else |
2127 | mView->toggleAllDaySize(); | 2148 | mView->toggleAllDaySize(); |
2128 | break; | 2149 | break; |
2129 | case Qt::Key_T: | 2150 | case Qt::Key_T: |
2130 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2151 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2131 | mView->newTodo(); | 2152 | mView->newTodo(); |
2132 | else { | 2153 | else { |
2133 | mView->goToday(); | 2154 | mView->goToday(); |
2134 | showSelectedDates = true; | 2155 | showSelectedDates = true; |
2135 | } | 2156 | } |
2136 | break; | 2157 | break; |
2137 | case Qt::Key_Q: | 2158 | case Qt::Key_Q: |
2138 | if ( e->state() == Qt::ControlButton ) | 2159 | if ( e->state() == Qt::ControlButton ) |
2139 | mView->conflictNotAll(); | 2160 | mView->conflictNotAll(); |
2140 | else if ( e->state() == Qt::ShiftButton ) | 2161 | else if ( e->state() == Qt::ShiftButton ) |
2141 | mView->conflictAllday(); | 2162 | mView->conflictAllday(); |
2142 | else | 2163 | else |
2143 | mView->conflictAll(); | 2164 | mView->conflictAll(); |
2144 | break; | 2165 | break; |
2145 | case Qt::Key_J: | 2166 | case Qt::Key_J: |
2146 | mView->viewManager()->showJournalView(); | 2167 | mView->viewManager()->showJournalView(); |
2147 | break; | 2168 | break; |
2148 | case Qt::Key_B: | 2169 | case Qt::Key_B: |
2149 | mView->editIncidenceDescription();; | 2170 | mView->editIncidenceDescription();; |
2150 | break; | 2171 | break; |
2151 | // case Qt::Key_Return: | 2172 | // case Qt::Key_Return: |
2152 | case Qt::Key_E: | 2173 | case Qt::Key_E: |
2153 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2174 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2154 | mView->newEvent(); | 2175 | mView->newEvent(); |
2155 | else | 2176 | else |
2156 | mView->editIncidence(); | 2177 | mView->editIncidence(); |
2157 | break; | 2178 | break; |
2158 | case Qt::Key_Plus: | 2179 | case Qt::Key_Plus: |
2159 | size = p->mHourSize +2; | 2180 | size = p->mHourSize +2; |
2160 | if ( size <= 22 ) | 2181 | if ( size <= 22 ) |
2161 | configureAgenda( size ); | 2182 | configureAgenda( size ); |
2162 | break; | 2183 | break; |
2163 | case Qt::Key_Minus: | 2184 | case Qt::Key_Minus: |
2164 | size = p->mHourSize - 2; | 2185 | size = p->mHourSize - 2; |
2165 | if ( size >= 4 ) | 2186 | if ( size >= 4 ) |
2166 | configureAgenda( size ); | 2187 | configureAgenda( size ); |
2167 | break; | 2188 | break; |
2168 | 2189 | ||
2169 | 2190 | ||
2170 | default: | 2191 | default: |
2171 | e->ignore(); | 2192 | e->ignore(); |
2172 | } | 2193 | } |
2173 | if ( pro > 0 ) { | 2194 | if ( pro > 0 ) { |
2174 | selectFilter( pro+1 ); | 2195 | selectFilter( pro+1 ); |
2175 | } | 2196 | } |
2176 | if ( showSelectedDates ) { | 2197 | if ( showSelectedDates ) { |
2177 | ;// setCaptionToDates(); | 2198 | ;// setCaptionToDates(); |
2178 | } | 2199 | } |
2179 | 2200 | ||
2180 | } | 2201 | } |
2181 | void MainWindow::fillFilterMenuTB() | 2202 | void MainWindow::fillFilterMenuTB() |
2182 | { | 2203 | { |
2183 | selectFilterMenuTB->clear(); | 2204 | selectFilterMenuTB->clear(); |
2184 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2205 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2185 | selectFilterMenuTB->insertSeparator(); | 2206 | selectFilterMenuTB->insertSeparator(); |
2186 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2207 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2187 | 2208 | ||
2188 | selectFilterMenuTB->insertSeparator(); | 2209 | selectFilterMenuTB->insertSeparator(); |
2189 | QPtrList<CalFilter> fili = mView->filters(); | 2210 | QPtrList<CalFilter> fili = mView->filters(); |
2190 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2211 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2191 | CalFilter *filter = fili.first(); | 2212 | CalFilter *filter = fili.first(); |
2192 | int iii = 2; | 2213 | int iii = 2; |
2193 | bool checkitem = mView->filterView()->filtersEnabled(); | 2214 | bool checkitem = mView->filterView()->filtersEnabled(); |
2194 | while(filter) { | 2215 | while(filter) { |
2195 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2216 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2196 | if ( filter == curfilter) | 2217 | if ( filter == curfilter) |
2197 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2218 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2198 | filter = fili.next(); | 2219 | filter = fili.next(); |
2199 | ++iii; | 2220 | ++iii; |
2200 | } | 2221 | } |
2201 | if ( !checkitem ) | 2222 | if ( !checkitem ) |
2202 | selectFilterMenuTB->setItemChecked( 1, true ); | 2223 | selectFilterMenuTB->setItemChecked( 1, true ); |
2203 | 2224 | ||
2204 | int x = 0; | 2225 | int x = 0; |
2205 | int y = iconToolBar->height(); | 2226 | int y = iconToolBar->height(); |
2206 | int dX = 0; | 2227 | int dX = 0; |
2207 | int dY = 0; | 2228 | int dY = 0; |
2208 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2229 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2209 | if ( iconToolBar->y() > height()/2 ) { | 2230 | if ( iconToolBar->y() > height()/2 ) { |
2210 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2231 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2211 | y = 0; | 2232 | y = 0; |
2212 | } | 2233 | } |
2213 | } else { | 2234 | } else { |
2214 | if ( iconToolBar->x() > width()/2 ) { // right side | 2235 | if ( iconToolBar->x() > width()/2 ) { // right side |
2215 | x=0; | 2236 | x=0; |
2216 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2237 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2217 | y = 0; | 2238 | y = 0; |
2218 | } else { | 2239 | } else { |
2219 | x= iconToolBar->width(); | 2240 | x= iconToolBar->width(); |
2220 | y = 0; | 2241 | y = 0; |
2221 | } | 2242 | } |
2222 | } | 2243 | } |
2223 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2244 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2224 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2245 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2225 | } | 2246 | } |
2226 | void MainWindow::fillFilterMenu() | 2247 | void MainWindow::fillFilterMenu() |
2227 | { | 2248 | { |
2228 | selectFilterMenu->clear(); | 2249 | selectFilterMenu->clear(); |
2229 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2250 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2230 | selectFilterMenu->insertSeparator(); | 2251 | selectFilterMenu->insertSeparator(); |
2231 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2252 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2232 | 2253 | ||
2233 | selectFilterMenu->insertSeparator(); | 2254 | selectFilterMenu->insertSeparator(); |
2234 | QPtrList<CalFilter> fili = mView->filters(); | 2255 | QPtrList<CalFilter> fili = mView->filters(); |
2235 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2256 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2236 | CalFilter *filter = fili.first(); | 2257 | CalFilter *filter = fili.first(); |
2237 | int iii = 2; | 2258 | int iii = 2; |
2238 | bool checkitem = mView->filterView()->filtersEnabled(); | 2259 | bool checkitem = mView->filterView()->filtersEnabled(); |
2239 | while(filter) { | 2260 | while(filter) { |
2240 | selectFilterMenu->insertItem( filter->name(), iii ); | 2261 | selectFilterMenu->insertItem( filter->name(), iii ); |
2241 | if ( filter == curfilter) | 2262 | if ( filter == curfilter) |
2242 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2263 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2243 | filter = fili.next(); | 2264 | filter = fili.next(); |
2244 | ++iii; | 2265 | ++iii; |
2245 | } | 2266 | } |
2246 | if ( !checkitem ) | 2267 | if ( !checkitem ) |
2247 | selectFilterMenu->setItemChecked( 1, true ); | 2268 | selectFilterMenu->setItemChecked( 1, true ); |
2248 | } | 2269 | } |
2249 | void MainWindow::fillFilterMenuPopup() | 2270 | void MainWindow::fillFilterMenuPopup() |
2250 | { | 2271 | { |
2251 | filterPopupMenu->clear(); | 2272 | filterPopupMenu->clear(); |
2252 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2273 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2253 | 2274 | ||
2254 | filterPopupMenu->insertSeparator(); | 2275 | filterPopupMenu->insertSeparator(); |
2255 | QPtrList<CalFilter> fili = mView->filters(); | 2276 | QPtrList<CalFilter> fili = mView->filters(); |
2256 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2277 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2257 | CalFilter *filter = fili.first(); | 2278 | CalFilter *filter = fili.first(); |
2258 | int iii = 1; | 2279 | int iii = 1; |
2259 | bool checkitem = mView->filterView()->filtersEnabled(); | 2280 | bool checkitem = mView->filterView()->filtersEnabled(); |
2260 | while(filter) { | 2281 | while(filter) { |
2261 | filterPopupMenu->insertItem( filter->name(), iii ); | 2282 | filterPopupMenu->insertItem( filter->name(), iii ); |
2262 | if ( filter == curfilter) | 2283 | if ( filter == curfilter) |
2263 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2284 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2264 | filter = fili.next(); | 2285 | filter = fili.next(); |
2265 | ++iii; | 2286 | ++iii; |
2266 | } | 2287 | } |
2267 | if ( !checkitem ) | 2288 | if ( !checkitem ) |
2268 | filterPopupMenu->setItemChecked( 0, true ); | 2289 | filterPopupMenu->setItemChecked( 0, true ); |
2269 | } | 2290 | } |
2270 | void MainWindow::selectFilter( int fil ) | 2291 | void MainWindow::selectFilter( int fil ) |
2271 | { | 2292 | { |
2272 | 2293 | ||
2273 | if ( fil == 0 ) { | 2294 | if ( fil == 0 ) { |
2274 | mView->editFilters( ); | 2295 | mView->editFilters( ); |
2275 | } else if ( fil == 1 ){ | 2296 | } else if ( fil == 1 ){ |
2276 | if ( mView->filterView()->filtersEnabled() ) | 2297 | if ( mView->filterView()->filtersEnabled() ) |
2277 | mView->toggleFilerEnabled( ); | 2298 | mView->toggleFilerEnabled( ); |
2278 | } else { | 2299 | } else { |
2279 | if ( !mView->filterView()->filtersEnabled() ) { | 2300 | if ( !mView->filterView()->filtersEnabled() ) { |
2280 | mView->filterView()->blockSignals( true ); | 2301 | mView->filterView()->blockSignals( true ); |
2281 | mView->toggleFilerEnabled( ); | 2302 | mView->toggleFilerEnabled( ); |
2282 | mView->filterView()->blockSignals( false ); | 2303 | mView->filterView()->blockSignals( false ); |
2283 | } | 2304 | } |
2284 | mView->selectFilter( fil-2 ); | 2305 | mView->selectFilter( fil-2 ); |
2285 | } | 2306 | } |
2286 | } | 2307 | } |
2287 | void MainWindow::updateFilterToolbar() | 2308 | void MainWindow::updateFilterToolbar() |
2288 | { | 2309 | { |
2289 | if ( filterMenubar ) { | 2310 | if ( filterMenubar ) { |
2290 | if ( !mView->filterView()->filtersEnabled() ) { | 2311 | if ( !mView->filterView()->filtersEnabled() ) { |
2291 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2312 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2292 | } else { | 2313 | } else { |
2293 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2314 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2294 | if ( curfilter ) { | 2315 | if ( curfilter ) { |
2295 | filterMenubar->changeItem( 0, curfilter->name() ); | 2316 | filterMenubar->changeItem( 0, curfilter->name() ); |
2296 | } | 2317 | } |
2297 | } | 2318 | } |
2298 | } | 2319 | } |
2299 | } | 2320 | } |
2300 | void MainWindow::selectFilterPopup( int fil ) | 2321 | void MainWindow::selectFilterPopup( int fil ) |
2301 | { | 2322 | { |
2302 | selectFilter( fil + 1 ); | 2323 | selectFilter( fil + 1 ); |
2303 | 2324 | ||
2304 | } | 2325 | } |
2305 | void MainWindow::configureToolBar( int item ) | 2326 | void MainWindow::configureToolBar( int item ) |
2306 | { | 2327 | { |
2307 | 2328 | ||
2308 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2329 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2309 | KOPrefs *p = KOPrefs::instance(); | 2330 | KOPrefs *p = KOPrefs::instance(); |
2310 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2331 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2311 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2332 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2312 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2333 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2313 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2334 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2314 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2335 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2315 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2336 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2316 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2337 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2317 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2338 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2318 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2339 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2319 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2340 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2320 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2341 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2321 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2342 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2322 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2343 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2323 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2344 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2324 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2345 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2325 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2346 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2326 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2347 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2327 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2348 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2328 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2349 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2329 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2350 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2330 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2351 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2331 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2352 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2332 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2353 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2333 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2354 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2334 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2355 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2335 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2356 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2336 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2357 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2337 | // initActions(); | 2358 | // initActions(); |
2338 | setCaption ( i18n("Toolbar changes needs a restart!") ); | 2359 | setCaption ( i18n("Toolbar changes needs a restart!") ); |
2339 | } | 2360 | } |
2340 | void MainWindow::setCaption ( const QString & c ) | 2361 | void MainWindow::setCaption ( const QString & c ) |
2341 | { | 2362 | { |
2342 | QString cap = c; | 2363 | QString cap = c; |
2343 | cap.replace( QRegExp("\n"), " " ); | 2364 | cap.replace( QRegExp("\n"), " " ); |
2344 | cap = cap.stripWhiteSpace(); | 2365 | cap = cap.stripWhiteSpace(); |
2345 | if ( cap.isEmpty() ) | 2366 | if ( cap.isEmpty() ) |
2346 | cap = "KO/Pi"; | 2367 | cap = "KO/Pi"; |
2347 | QWidget::setCaption( cap ); | 2368 | QWidget::setCaption( cap ); |
2348 | } | 2369 | } |
2349 | void MainWindow::setCaptionToDates() | 2370 | void MainWindow::setCaptionToDates() |
2350 | { | 2371 | { |
2351 | QString selDates; | 2372 | QString selDates; |
2352 | QDate date = mView->startDate(); | 2373 | QDate date = mView->startDate(); |
2353 | if ( ! date.isValid() ) { | 2374 | if ( ! date.isValid() ) { |
2354 | setCaption(""); | 2375 | setCaption(""); |
2355 | return; | 2376 | return; |
2356 | } | 2377 | } |
2357 | selDates = KGlobal::locale()->formatDate( date, true); | 2378 | selDates = KGlobal::locale()->formatDate( date, true); |
2358 | if (mView->startDate() < mView->endDate() ) | 2379 | if (mView->startDate() < mView->endDate() ) |
2359 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2380 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2360 | else { | 2381 | else { |
2361 | QString addString; | 2382 | QString addString; |
2362 | if ( date == QDateTime::currentDateTime().date() ) | 2383 | if ( date == QDateTime::currentDateTime().date() ) |
2363 | addString = i18n("Today"); | 2384 | addString = i18n("Today"); |
2364 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2385 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2365 | addString = i18n("Tomorrow"); | 2386 | addString = i18n("Tomorrow"); |
2366 | if ( !addString.isEmpty() ) | 2387 | if ( !addString.isEmpty() ) |
2367 | selDates = addString+", "+selDates ; | 2388 | selDates = addString+", "+selDates ; |
2368 | } | 2389 | } |
2369 | setCaption( i18n("Dates: ") + selDates ); | 2390 | setCaption( i18n("Dates: ") + selDates ); |
2370 | 2391 | ||
2371 | } | 2392 | } |
2372 | void MainWindow::showConfigureAgenda( ) | 2393 | void MainWindow::showConfigureAgenda( ) |
2373 | { | 2394 | { |
2374 | int iii; | 2395 | int iii; |
2375 | for ( iii = 1;iii<= 10 ;++iii ){ | 2396 | for ( iii = 1;iii<= 10 ;++iii ){ |
2376 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2397 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2377 | } | 2398 | } |
2378 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2399 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2379 | } | 2400 | } |
2380 | void MainWindow::configureAgenda( int item ) | 2401 | void MainWindow::configureAgenda( int item ) |
2381 | { | 2402 | { |
2382 | if ( KOPrefs::instance()->mHourSize == item ) | 2403 | if ( KOPrefs::instance()->mHourSize == item ) |
2383 | return; | 2404 | return; |
2384 | KOPrefs::instance()->mHourSize=item; | 2405 | KOPrefs::instance()->mHourSize=item; |
2385 | mView->viewManager()->agendaView()->updateConfig(); | 2406 | mView->viewManager()->agendaView()->updateConfig(); |
2386 | } | 2407 | } |
2387 | 2408 | ||
2388 | void MainWindow::saveCalendar() | 2409 | void MainWindow::saveCalendar() |
2389 | { | 2410 | { |
2390 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 2411 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
2391 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 2412 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
2392 | bupDir = KGlobalSettings::backupDataDir(); | 2413 | bupDir = KGlobalSettings::backupDataDir(); |
2393 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); | 2414 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); |
2394 | QString bupHint; | 2415 | QString bupHint; |
2395 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) | 2416 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) |
2396 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); | 2417 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); |
2397 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; | 2418 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; |
2398 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; | 2419 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; |
2399 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 2420 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
2400 | save(); | 2421 | save(); |
2401 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; | 2422 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; |
2402 | backupAllFiles(); | 2423 | backupAllFiles(); |
2403 | } | 2424 | } |
2404 | void MainWindow::loadCalendar() | 2425 | void MainWindow::loadCalendar() |
2405 | { | 2426 | { |
2406 | 2427 | ||
2407 | 2428 | ||
2408 | #if 0 | 2429 | #if 0 |
2409 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2430 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2410 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2431 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2411 | 2432 | ||
2412 | if ( fn == "" ) | 2433 | if ( fn == "" ) |
2413 | return; | 2434 | return; |
2414 | QFileInfo info; | 2435 | QFileInfo info; |
2415 | info.setFile( fn ); | 2436 | info.setFile( fn ); |
2416 | QString mess; | 2437 | QString mess; |
2417 | bool loadbup = true; | 2438 | bool loadbup = true; |
2418 | if ( info. exists() ) { | 2439 | if ( info. exists() ) { |
2419 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2440 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2420 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2441 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2421 | mess, | 2442 | mess, |
2422 | i18n("Load!"), i18n("Cancel"), 0, | 2443 | i18n("Load!"), i18n("Cancel"), 0, |
2423 | 0, 1 ); | 2444 | 0, 1 ); |
2424 | if ( result != 0 ) { | 2445 | if ( result != 0 ) { |
2425 | loadbup = false; | 2446 | loadbup = false; |
2426 | } | 2447 | } |
2427 | } else { | 2448 | } else { |
2428 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2449 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2429 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2450 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2430 | 0, 1 ); | 2451 | 0, 1 ); |
2431 | 2452 | ||
2432 | return; | 2453 | return; |
2433 | } | 2454 | } |
2434 | if ( loadbup ) { | 2455 | if ( loadbup ) { |
2435 | mView->openCalendar( fn ); | 2456 | mView->openCalendar( fn ); |
2436 | KOPrefs::instance()->mLastLoadFile = fn; | 2457 | KOPrefs::instance()->mLastLoadFile = fn; |
2437 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2458 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2438 | setCaption(mess); | 2459 | setCaption(mess); |
2439 | } | 2460 | } |
2440 | #endif | 2461 | #endif |
2441 | 2462 | ||
2442 | } | 2463 | } |
2443 | void MainWindow::quickImportIcal() | 2464 | void MainWindow::quickImportIcal() |
2444 | { | 2465 | { |
2445 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2466 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2446 | } | 2467 | } |
2447 | void MainWindow::importFile( QString fn, bool quick ) | 2468 | void MainWindow::importFile( QString fn, bool quick ) |
2448 | { | 2469 | { |
2449 | QFileInfo info; | 2470 | QFileInfo info; |
2450 | info.setFile( fn ); | 2471 | info.setFile( fn ); |
2451 | QString mess; | 2472 | QString mess; |
2452 | if ( !info. exists() ) { | 2473 | if ( !info. exists() ) { |
2453 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2474 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2454 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2475 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2455 | mess ); | 2476 | mess ); |
2456 | return; | 2477 | return; |
2457 | } | 2478 | } |
2458 | int result = 0; | 2479 | int result = 0; |
2459 | if ( !quick ) { | 2480 | if ( !quick ) { |
2460 | 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 )); | 2481 | 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 )); |
2461 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2482 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2462 | mess, | 2483 | mess, |
2463 | "Import", "Cancel", 0, | 2484 | "Import", "Cancel", 0, |
2464 | 0, 1 ); | 2485 | 0, 1 ); |
2465 | } | 2486 | } |
2466 | if ( result == 0 ) { | 2487 | if ( result == 0 ) { |
2467 | if ( mView->openCalendar( fn, true )) { | 2488 | if ( mView->openCalendar( fn, true )) { |
2468 | KOPrefs::instance()->mLastImportFile = fn; | 2489 | KOPrefs::instance()->mLastImportFile = fn; |
2469 | setCaption(i18n("Imported file successfully")); | 2490 | setCaption(i18n("Imported file successfully")); |
2470 | } else { | 2491 | } else { |
2471 | setCaption(i18n("Error importing file")); | 2492 | setCaption(i18n("Error importing file")); |
2472 | } | 2493 | } |
2473 | } | 2494 | } |
2474 | } | 2495 | } |
2475 | 2496 | ||
2476 | void MainWindow::importIcal() | 2497 | void MainWindow::importIcal() |
2477 | { | 2498 | { |
2478 | 2499 | ||
2479 | QString fn =KOPrefs::instance()->mLastImportFile; | 2500 | QString fn =KOPrefs::instance()->mLastImportFile; |
2480 | 2501 | ||
2481 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2502 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2482 | if ( fn == "" ) | 2503 | if ( fn == "" ) |
2483 | return; | 2504 | return; |
2484 | importFile( fn, true ); | 2505 | importFile( fn, true ); |
2485 | 2506 | ||
2486 | } | 2507 | } |
2487 | 2508 | ||
2488 | void MainWindow::exportVCalendar() | 2509 | void MainWindow::exportVCalendar() |
2489 | { | 2510 | { |
2490 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2511 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2491 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2512 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2492 | if ( fn == "" ) | 2513 | if ( fn == "" ) |
2493 | return; | 2514 | return; |
2494 | QFileInfo info; | 2515 | QFileInfo info; |
2495 | info.setFile( fn ); | 2516 | info.setFile( fn ); |
2496 | QString mes; | 2517 | QString mes; |
2497 | bool createbup = true; | 2518 | bool createbup = true; |
2498 | if ( info. exists() ) { | 2519 | if ( info. exists() ) { |
2499 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2520 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2500 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2521 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2501 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2522 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2502 | 0, 1 ); | 2523 | 0, 1 ); |
2503 | if ( result != 0 ) { | 2524 | if ( result != 0 ) { |
2504 | createbup = false; | 2525 | createbup = false; |
2505 | } | 2526 | } |
2506 | } | 2527 | } |
2507 | if ( createbup ) { | 2528 | if ( createbup ) { |
2508 | if ( mView->exportVCalendar( fn ) ) { | 2529 | if ( mView->exportVCalendar( fn ) ) { |
2509 | KOPrefs::instance()->mLastVcalFile = fn; | 2530 | KOPrefs::instance()->mLastVcalFile = fn; |
2510 | if ( fn.length() > 20 ) | 2531 | if ( fn.length() > 20 ) |
2511 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2532 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2512 | else | 2533 | else |
2513 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2534 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2514 | setCaption(mes); | 2535 | setCaption(mes); |
2515 | } | 2536 | } |
2516 | } | 2537 | } |
2517 | 2538 | ||
2518 | } | 2539 | } |
2519 | QString MainWindow::sentSyncFile() | 2540 | QString MainWindow::sentSyncFile() |
2520 | { | 2541 | { |
2521 | #ifdef DESKTOP_VERSION | 2542 | #ifdef DESKTOP_VERSION |
2522 | return locateLocal( "tmp", "copysynccal.ics" ); | 2543 | return locateLocal( "tmp", "copysynccal.ics" ); |
2523 | #else | 2544 | #else |
2524 | return QString( "/tmp/copysynccal.ics" ); | 2545 | return QString( "/tmp/copysynccal.ics" ); |
2525 | #endif | 2546 | #endif |
2526 | } | 2547 | } |
2527 | 2548 | ||
2528 | void MainWindow::syncFileRequest() | 2549 | void MainWindow::syncFileRequest() |
2529 | { | 2550 | { |
2530 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2551 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2531 | mSyncManager->slotSyncMenu( 999 ); | 2552 | mSyncManager->slotSyncMenu( 999 ); |
2532 | } | 2553 | } |
2533 | 2554 | ||
2534 | setCaption(i18n("Saving Data to temp file ..." )); | 2555 | setCaption(i18n("Saving Data to temp file ..." )); |
2535 | mView->saveCalendar( sentSyncFile() ); | 2556 | mView->saveCalendar( sentSyncFile() ); |
2536 | setCaption(i18n("Data saved to temp file!" )); | 2557 | setCaption(i18n("Data saved to temp file!" )); |
2537 | 2558 | ||
2538 | } | 2559 | } |
2539 | void MainWindow::getFile( bool success ) | 2560 | void MainWindow::getFile( bool success ) |
2540 | { | 2561 | { |
2541 | if ( ! success ) { | 2562 | if ( ! success ) { |
2542 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2563 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2543 | return; | 2564 | return; |
2544 | } | 2565 | } |
2545 | mView->mergeFile( sentSyncFile() ); | 2566 | mView->mergeFile( sentSyncFile() ); |
2546 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2567 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2547 | mSyncManager->slotSyncMenu( 999 ); | 2568 | mSyncManager->slotSyncMenu( 999 ); |
2548 | } | 2569 | } |
2549 | setCaption( i18n("Pi-Sync successful!") ); | 2570 | setCaption( i18n("Pi-Sync successful!") ); |
2550 | } | 2571 | } |
2551 | void MainWindow::printListView() | 2572 | void MainWindow::printListView() |
2552 | { | 2573 | { |
2553 | 2574 | ||
2554 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); | 2575 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); |
2555 | 2576 | ||
2556 | KMessageBox::information( this, message); | 2577 | KMessageBox::information( this, message); |
2557 | } | 2578 | } |
2558 | void MainWindow::printSel( ) | 2579 | void MainWindow::printSel( ) |
2559 | { | 2580 | { |
2560 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2581 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2561 | } | 2582 | } |
2562 | 2583 | ||
2563 | void MainWindow::printCal() | 2584 | void MainWindow::printCal() |
2564 | { | 2585 | { |
2565 | mView->print();//mCp->showDialog(); | 2586 | mView->print();//mCp->showDialog(); |
2566 | } | 2587 | } |
2567 | 2588 | ||
2568 | 2589 | ||
2569 | #include "libkdepim/kdatepicker.h" | 2590 | #include "libkdepim/kdatepicker.h" |
2570 | #include <kdatetbl.h> | 2591 | #include <kdatetbl.h> |
2571 | 2592 | ||
2572 | void MainWindow::weekAction() | 2593 | void MainWindow::weekAction() |
2573 | { | 2594 | { |
2574 | int month; | 2595 | int month; |
2575 | KPopupFrame* popup = new KPopupFrame(this); | 2596 | KPopupFrame* popup = new KPopupFrame(this); |
2576 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2597 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2577 | // ----- | 2598 | // ----- |
2578 | picker->resize(picker->sizeHint()); | 2599 | picker->resize(picker->sizeHint()); |
2579 | popup->setMainWidget(picker); | 2600 | popup->setMainWidget(picker); |
2580 | picker->setFocus(); | 2601 | picker->setFocus(); |
2581 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2602 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2582 | int x = 0; | 2603 | int x = 0; |
2583 | int y = iconToolBar->height(); | 2604 | int y = iconToolBar->height(); |
2584 | int dX = 0; | 2605 | int dX = 0; |
2585 | int dY = 0; | 2606 | int dY = 0; |
2586 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2607 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2587 | if ( iconToolBar->y() > height()/2 ) { | 2608 | if ( iconToolBar->y() > height()/2 ) { |
2588 | dY = picker->sizeHint().height()+8; | 2609 | dY = picker->sizeHint().height()+8; |
2589 | y = 0; | 2610 | y = 0; |
2590 | } | 2611 | } |
2591 | } else { | 2612 | } else { |
2592 | if ( iconToolBar->x() > width()/2 ) { // right side | 2613 | if ( iconToolBar->x() > width()/2 ) { // right side |
2593 | x=0; | 2614 | x=0; |
2594 | dX= picker->sizeHint().width()+8; | 2615 | dX= picker->sizeHint().width()+8; |
2595 | y = 0; | 2616 | y = 0; |
2596 | } else { | 2617 | } else { |
2597 | x= iconToolBar->width(); | 2618 | x= iconToolBar->width(); |
2598 | y = 0; | 2619 | y = 0; |
2599 | } | 2620 | } |
2600 | } | 2621 | } |
2601 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2622 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2602 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2623 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2603 | { | 2624 | { |
2604 | month = picker->getResult(); | 2625 | month = picker->getResult(); |
2605 | emit selectWeek ( month ); | 2626 | emit selectWeek ( month ); |
2606 | //qDebug("weekSelected %d ", month); | 2627 | //qDebug("weekSelected %d ", month); |
2607 | } | 2628 | } |
2608 | delete popup; | 2629 | delete popup; |
2609 | } | 2630 | } |
2610 | 2631 | ||
2611 | void MainWindow::hideEvent ( QHideEvent * ) | 2632 | void MainWindow::hideEvent ( QHideEvent * ) |
2612 | { | 2633 | { |
2613 | QString message; | 2634 | QString message; |
2614 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2635 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2615 | if ( nextA.isValid() ) { | 2636 | if ( nextA.isValid() ) { |
2616 | QString sum = mCalendar->nextSummary(); | 2637 | QString sum = mCalendar->nextSummary(); |
2617 | 2638 | ||
2618 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | 2639 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); |
2619 | setCaption( message ); | 2640 | setCaption( message ); |
2620 | } | 2641 | } |
2621 | } | 2642 | } |
2622 | 2643 | ||
2623 | void MainWindow::resizeEvent( QResizeEvent* e) | 2644 | void MainWindow::resizeEvent( QResizeEvent* e) |
2624 | { | 2645 | { |
2625 | #ifndef DESKTOP_VERSION | 2646 | #ifndef DESKTOP_VERSION |
2626 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { | 2647 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { |
2627 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) | 2648 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) |
2628 | filterToolBar->hide(); | 2649 | filterToolBar->hide(); |
2629 | else | 2650 | else |
2630 | filterToolBar->show(); | 2651 | filterToolBar->show(); |
2631 | } | 2652 | } |
2632 | #endif | 2653 | #endif |
2633 | QMainWindow::resizeEvent( e); | 2654 | QMainWindow::resizeEvent( e); |
2634 | } | 2655 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index e2de3ba..7d3d492 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,173 +1,178 @@ | |||
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 <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #include <kpopupmenu.h> | 14 | #include <kpopupmenu.h> |
15 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
16 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
17 | #endif | 17 | #endif |
18 | class QAction; | 18 | class QAction; |
19 | class CalendarView; | 19 | class CalendarView; |
20 | class KSyncProfile; | 20 | class KSyncProfile; |
21 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
22 | 22 | ||
23 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
24 | #endif | 24 | #endif |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | 26 | ||
27 | 27 | ||
28 | namespace KCal { | 28 | namespace KCal { |
29 | class CalendarLocal; | 29 | class CalendarLocal; |
30 | } | 30 | } |
31 | 31 | ||
32 | using namespace KCal; | 32 | using namespace KCal; |
33 | 33 | ||
34 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | MainWindow( QWidget *parent = 0, const char *name = 0 ); | 38 | MainWindow( QWidget *parent = 0, const char *name = 0 ); |
39 | ~MainWindow(); | 39 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | 40 | bool beamReceiveEnabled(); |
41 | static QString defaultFileName(); | 41 | static QString defaultFileName(); |
42 | static QString syncFileName(); | 42 | static QString syncFileName(); |
43 | static QString resourcePath(); | 43 | static QString resourcePath(); |
44 | public slots: | 44 | public slots: |
45 | void setUsesBigPixmaps ( bool ); | 45 | void setUsesBigPixmaps ( bool ); |
46 | void setCaption ( const QString & ); | 46 | void setCaption ( const QString & ); |
47 | void updateWeekNum(const KCal::DateList &); | 47 | void updateWeekNum(const KCal::DateList &); |
48 | void updateWeek(QDate); | 48 | void updateWeek(QDate); |
49 | void updateFilterToolbar(); | 49 | void updateFilterToolbar(); |
50 | virtual void showMaximized (); | 50 | virtual void showMaximized (); |
51 | void configureAgenda( int ); | 51 | void configureAgenda( int ); |
52 | void recieve( const QCString& msg, const QByteArray& data ); | 52 | void recieve( const QCString& msg, const QByteArray& data ); |
53 | protected slots: | 53 | protected slots: |
54 | void calHint(); | 54 | void calHint(); |
55 | void startMultiSync(); | 55 | void startMultiSync(); |
56 | void setCaptionToDates(); | 56 | void setCaptionToDates(); |
57 | void weekAction(); | 57 | void weekAction(); |
58 | void about(); | 58 | void about(); |
59 | void licence(); | 59 | void licence(); |
60 | void faq(); | 60 | void faq(); |
61 | void usertrans(); | 61 | void usertrans(); |
62 | void features(); | 62 | void features(); |
63 | void synchowto(); | 63 | void synchowto(); |
64 | void storagehowto(); | 64 | void storagehowto(); |
65 | void timetrackinghowto(); | 65 | void timetrackinghowto(); |
66 | void kdesynchowto(); | 66 | void kdesynchowto(); |
67 | void multisynchowto(); | 67 | void multisynchowto(); |
68 | void whatsNew(); | 68 | void whatsNew(); |
69 | void keyBindings(); | 69 | void keyBindings(); |
70 | void aboutAutoSaving();; | 70 | void aboutAutoSaving();; |
71 | void aboutKnownBugs(); | 71 | void aboutKnownBugs(); |
72 | 72 | ||
73 | void processIncidenceSelection( Incidence * ); | 73 | void processIncidenceSelection( Incidence * ); |
74 | 74 | ||
75 | void importQtopia(); | 75 | void importQtopia(); |
76 | void importBday(); | 76 | void importBday(); |
77 | void importOL(); | 77 | void importOL(); |
78 | void importIcal(); | 78 | void importIcal(); |
79 | void importFile( QString, bool ); | 79 | void importFile( QString, bool ); |
80 | void quickImportIcal(); | 80 | void quickImportIcal(); |
81 | 81 | ||
82 | void slotModifiedChanged( bool ); | 82 | void slotModifiedChanged( bool ); |
83 | 83 | ||
84 | void save(); | 84 | void save(); |
85 | void backupAllFiles(); | 85 | void backupAllFiles(); |
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 printListView(); | 90 | void printListView(); |
91 | void saveCalendar(); | 91 | void saveCalendar(); |
92 | void loadCalendar(); | 92 | void loadCalendar(); |
93 | void exportVCalendar(); | 93 | void exportVCalendar(); |
94 | void fillFilterMenu(); | 94 | void fillFilterMenu(); |
95 | void fillFilterMenuTB(); | 95 | void fillFilterMenuTB(); |
96 | void selectFilter( int ); | 96 | void selectFilter( int ); |
97 | void fillFilterMenuPopup(); | 97 | void fillFilterMenuPopup(); |
98 | void selectFilterPopup( int ); | 98 | void selectFilterPopup( int ); |
99 | void exportToPhone( int ); | 99 | void exportToPhone( int ); |
100 | void toggleBeamReceive(); | 100 | void toggleBeamReceive(); |
101 | void disableBR(bool); | 101 | void disableBR(bool); |
102 | signals: | 102 | signals: |
103 | void selectWeek ( int ); | 103 | void selectWeek ( int ); |
104 | private slots: | 104 | private slots: |
105 | void slotResetFocus(); | ||
106 | void slotResetFocusLoop(); | ||
105 | void showConfigureAgenda(); | 107 | void showConfigureAgenda(); |
106 | void getFile( bool ); | 108 | void getFile( bool ); |
107 | void syncFileRequest(); | 109 | void syncFileRequest(); |
108 | 110 | ||
109 | protected: | 111 | protected: |
112 | int mFocusLoop; | ||
110 | void hideEvent ( QHideEvent * ); | 113 | void hideEvent ( QHideEvent * ); |
111 | QString sentSyncFile(); | 114 | QString sentSyncFile(); |
112 | void displayText( QString, QString); | 115 | void displayText( QString, QString); |
113 | void enableIncidenceActions( bool ); | 116 | void enableIncidenceActions( bool ); |
114 | 117 | ||
115 | private: | 118 | private: |
119 | //void setMenuBar( QMenuBar * ); | ||
116 | bool mBRdisabled; | 120 | bool mBRdisabled; |
117 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
118 | QCopChannel* infrared; | 122 | QCopChannel* infrared; |
119 | #endif | 123 | #endif |
120 | QAction* brAction; | 124 | QAction* brAction; |
121 | KSyncManager* mSyncManager; | 125 | KSyncManager* mSyncManager; |
122 | bool mClosed; | 126 | bool mClosed; |
123 | void saveOnClose(); | 127 | void saveOnClose(); |
124 | bool mFlagKeyPressed; | 128 | bool mFlagKeyPressed; |
125 | bool mBlockAtStartup; | 129 | bool mBlockAtStartup; |
130 | KMenuBar *menuBar1; | ||
126 | QPEToolBar *iconToolBar; | 131 | QPEToolBar *iconToolBar; |
127 | QPEToolBar *viewToolBar; | 132 | QPEToolBar *viewToolBar; |
128 | QPEToolBar *navigatorToolBar; | 133 | QPEToolBar *navigatorToolBar; |
129 | QPEToolBar *filterToolBar; | 134 | QPEToolBar *filterToolBar; |
130 | KMenuBar *filterMenubar; | 135 | KMenuBar *filterMenubar; |
131 | QPopupMenu * filterPopupMenu; | 136 | QPopupMenu * filterPopupMenu; |
132 | QPopupMenu * mCurrentItemMenu; | 137 | QPopupMenu * mCurrentItemMenu; |
133 | void initActions(); | 138 | void initActions(); |
134 | void setDefaultPreferences(); | 139 | void setDefaultPreferences(); |
135 | void resizeEvent( QResizeEvent* e); | 140 | void resizeEvent( QResizeEvent* e); |
136 | void keyPressEvent ( QKeyEvent * ) ; | 141 | void keyPressEvent ( QKeyEvent * ) ; |
137 | void keyReleaseEvent ( QKeyEvent * ) ; | 142 | void keyReleaseEvent ( QKeyEvent * ) ; |
138 | QPopupMenu *configureToolBarMenu; | 143 | QPopupMenu *configureToolBarMenu; |
139 | QPopupMenu *selectFilterMenu; | 144 | QPopupMenu *selectFilterMenu; |
140 | QPopupMenu *selectFilterMenuTB; | 145 | QPopupMenu *selectFilterMenuTB; |
141 | QPopupMenu *configureAgendaMenu, *syncMenu; | 146 | QPopupMenu *configureAgendaMenu, *syncMenu; |
142 | CalendarLocal *mCalendar; | 147 | CalendarLocal *mCalendar; |
143 | CalendarView *mView; | 148 | CalendarView *mView; |
144 | QAction *mNewSubTodoAction; | 149 | QAction *mNewSubTodoAction; |
145 | QAction *mWeekAction; | 150 | QAction *mWeekAction; |
146 | QFont mWeekFont; | 151 | QFont mWeekFont; |
147 | QPixmap mWeekPixmap; | 152 | QPixmap mWeekPixmap; |
148 | QColor mWeekBgColor; | 153 | QColor mWeekBgColor; |
149 | 154 | ||
150 | QAction *mShowAction; | 155 | QAction *mShowAction; |
151 | QAction *mEditAction; | 156 | QAction *mEditAction; |
152 | QAction *mDeleteAction; | 157 | QAction *mDeleteAction; |
153 | QAction *mCloneAction; | 158 | QAction *mCloneAction; |
154 | QAction *mMoveAction; | 159 | QAction *mMoveAction; |
155 | QAction *mBeamAction; | 160 | QAction *mBeamAction; |
156 | QAction *mCancelAction; | 161 | QAction *mCancelAction; |
157 | QAction *mPrintSelAction; | 162 | QAction *mPrintSelAction; |
158 | 163 | ||
159 | QAction *mToggleNav; | 164 | QAction *mToggleNav; |
160 | QAction *mToggleFilter; | 165 | QAction *mToggleFilter; |
161 | QAction *mToggleAllday; | 166 | QAction *mToggleAllday; |
162 | QAction *actionFilterMenuTB; | 167 | QAction *actionFilterMenuTB; |
163 | 168 | ||
164 | void closeEvent( QCloseEvent* ce ); | 169 | void closeEvent( QCloseEvent* ce ); |
165 | QTimer mSaveTimer; | 170 | QTimer mSaveTimer; |
166 | //bool mBlockSaveFlag; | 171 | //bool mBlockSaveFlag; |
167 | bool mCalendarModifiedFlag; | 172 | bool mCalendarModifiedFlag; |
168 | QPixmap loadPixmap( QString ); | 173 | QPixmap loadPixmap( QString ); |
169 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; | 174 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; |
170 | }; | 175 | }; |
171 | 176 | ||
172 | 177 | ||
173 | #endif | 178 | #endif |