-rw-r--r-- | bin/kdepim/WhatsNew.txt | 3 | ||||
-rw-r--r-- | korganizer/koimportoldialog.cpp | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 06d630a..52590d8 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,201 +1,204 @@ | |||
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.17 ************ | 3 | ********** VERSION 2.1.17 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Added option to display times in What's Next View on two lines. | 6 | Added option to display times in What's Next View on two lines. |
7 | (Useful for display on the Zaurus with 240x320 screen) | 7 | (Useful for display on the Zaurus with 240x320 screen) |
8 | Removed "Allday" for allday events of one day duration in What's Next View. | 8 | Removed "Allday" for allday events of one day duration in What's Next View. |
9 | Added date range for allday events of more than one day duration in What's Next View. | 9 | Added date range for allday events of more than one day duration in What's Next View. |
10 | Fixed two problems in the data importing from Outlook: | ||
11 | Fixed the duplicated import if the summary, location or description had whitespaces at the end. | ||
12 | Fixed a problem importing certain recurrence rules. | ||
10 | 13 | ||
11 | ********** VERSION 2.1.16 ************ | 14 | ********** VERSION 2.1.16 ************ |
12 | 15 | ||
13 | Fixed a problem with the menu bar in KO/Pi and using the "Menu" hardware key on the Zaurus. | 16 | Fixed a problem with the menu bar in KO/Pi and using the "Menu" hardware key on the Zaurus. |
14 | Added columns for datetime in todo view: Last modified, created and last modified subtodo | 17 | Added columns for datetime in todo view: Last modified, created and last modified subtodo |
15 | Fixed a bug in agenda view displaying recurring multiday events which are longer than two days. | 18 | Fixed a bug in agenda view displaying recurring multiday events which are longer than two days. |
16 | Made conflict detection up to 4 times faster. | 19 | Made conflict detection up to 4 times faster. |
17 | 20 | ||
18 | ********** VERSION 2.1.15 ************ | 21 | ********** VERSION 2.1.15 ************ |
19 | 22 | ||
20 | Fixed two layout problems on the Z: | 23 | Fixed two layout problems on the Z: |
21 | Made the with of the newly added buttons on the Quick-Todo smaller. | 24 | Made the with of the newly added buttons on the Quick-Todo smaller. |
22 | Made listweek layout in 2 columns on the Z760 in portait screen and full menubar visible. | 25 | Made listweek layout in 2 columns on the Z760 in portait screen and full menubar visible. |
23 | 26 | ||
24 | 27 | ||
25 | ********** VERSION 2.1.14 ************ | 28 | ********** VERSION 2.1.14 ************ |
26 | 29 | ||
27 | 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. | 30 | 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. |
28 | Added a button to add a subtodo quickly. | 31 | Added a button to add a subtodo quickly. |
29 | 32 | ||
30 | Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ). | 33 | Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ). |
31 | Added an option to change the layout of the list week to column mode. | 34 | Added an option to change the layout of the list week to column mode. |
32 | 35 | ||
33 | Fixed some usability problems in pi-sync mode by adding some progress information about file transfer. | 36 | Fixed some usability problems in pi-sync mode by adding some progress information about file transfer. |
34 | 37 | ||
35 | Fixed pi-sync problems with the new multi calendar feature. | 38 | Fixed pi-sync problems with the new multi calendar feature. |
36 | Now pi-sync behaviour should be: | 39 | Now pi-sync behaviour should be: |
37 | 1) Local sends file request ( as usual ) | 40 | 1) Local sends file request ( as usual ) |
38 | 2) Remote sends file which contains data of all enabled ( the calendar where the "eye" column is checked ) calendars. | 41 | 2) Remote sends file which contains data of all enabled ( the calendar where the "eye" column is checked ) calendars. |
39 | 3) Local syncs with data, adds new entries to default calendar and sends file back ( as usual ). | 42 | 3) Local syncs with data, adds new entries to default calendar and sends file back ( as usual ). |
40 | 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. | 43 | 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. |
41 | 4) Remote updates the data and adds new entries to default calendar. Readonly entries are not changed on remote. | 44 | 4) Remote updates the data and adds new entries to default calendar. Readonly entries are not changed on remote. |
42 | 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. | 45 | 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. |
43 | 46 | ||
44 | Summary: | 47 | Summary: |
45 | 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. | 48 | 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. |
46 | If you have different calendars on remote and local and some of them disabled you may get some "strange" bahaviour. | 49 | If you have different calendars on remote and local and some of them disabled you may get some "strange" bahaviour. |
47 | Well, the syncing has become quite complicated ... you should have no problems if you enable all calendars. | 50 | Well, the syncing has become quite complicated ... you should have no problems if you enable all calendars. |
48 | 51 | ||
49 | ********** VERSION 2.1.13 ************ | 52 | ********** VERSION 2.1.13 ************ |
50 | 53 | ||
51 | Fixed a problem in KA/Pi search. | 54 | Fixed a problem in KA/Pi search. |
52 | Fixed some minor problems in KO/Pi. | 55 | Fixed some minor problems in KO/Pi. |
53 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. | 56 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. |
54 | 57 | ||
55 | Fixed memory usage problems in KA/Pi: | 58 | Fixed memory usage problems in KA/Pi: |
56 | When loading data KA/Pi did load the file data twice. | 59 | When loading data KA/Pi did load the file data twice. |
57 | Example: | 60 | Example: |
58 | A 600k file did consume 1200k memory during loading process. | 61 | A 600k file did consume 1200k memory during loading process. |
59 | This is fixed, it does now consume only 600k during loading process. | 62 | This is fixed, it does now consume only 600k during loading process. |
60 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. | 63 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. |
61 | This is fixed. | 64 | This is fixed. |
62 | Example: | 65 | Example: |
63 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. | 66 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. |
64 | 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. | 67 | 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. |
65 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. | 68 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. |
66 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. | 69 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. |
67 | The saving of data may be a bit slower now. | 70 | The saving of data may be a bit slower now. |
68 | 71 | ||
69 | Fixed memory usage problems in KO/Pi: | 72 | Fixed memory usage problems in KO/Pi: |
70 | When KO/Pi did save the data to file, it did not release the used buffers after saving. | 73 | When KO/Pi did save the data to file, it did not release the used buffers after saving. |
71 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. | 74 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. |
72 | This is fixed. | 75 | This is fixed. |
73 | Example: | 76 | Example: |
74 | When saving a 400k file KO/Pi do now use 400k less memory now. | 77 | When saving a 400k file KO/Pi do now use 400k less memory now. |
75 | 78 | ||
76 | Optimized memory usage in KO/Pi Agenda view: | 79 | Optimized memory usage in KO/Pi Agenda view: |
77 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. | 80 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. |
78 | These buffers were not made smaller (i.e. downsized) because of performance reasons. | 81 | These buffers were not made smaller (i.e. downsized) because of performance reasons. |
79 | The handling of these buffers are now much smarter: | 82 | The handling of these buffers are now much smarter: |
80 | Two (of six) buffers are removed completely. | 83 | Two (of six) buffers are removed completely. |
81 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. | 84 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. |
82 | 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. | 85 | 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. |
83 | 86 | ||
84 | Worst case example ( for a maximum size agenda content): | 87 | Worst case example ( for a maximum size agenda content): |
85 | 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. | 88 | 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. |
86 | 89 | ||
87 | 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. | 90 | 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. |
88 | 91 | ||
89 | Summary: | 92 | Summary: |
90 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. | 93 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. |
91 | 94 | ||
92 | ********** VERSION 2.1.12 ************ | 95 | ********** VERSION 2.1.12 ************ |
93 | 96 | ||
94 | KO/Pi: | 97 | KO/Pi: |
95 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. | 98 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. |
96 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. | 99 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. |
97 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). | 100 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). |
98 | Fixed some other small problems. | 101 | Fixed some other small problems. |
99 | 102 | ||
100 | ********** VERSION 2.1.11 ************ | 103 | ********** VERSION 2.1.11 ************ |
101 | 104 | ||
102 | KO/Pi: | 105 | KO/Pi: |
103 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. | 106 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. |
104 | Added features to handle (and add ) more than one journal entry per day. | 107 | Added features to handle (and add ) more than one journal entry per day. |
105 | Added option for a journal title. | 108 | Added option for a journal title. |
106 | 109 | ||
107 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. | 110 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. |
108 | Fixed a problem of the alarm of completed recurring todos. | 111 | Fixed a problem of the alarm of completed recurring todos. |
109 | Added to the event/todo editor to set quickly the category of an item. | 112 | Added to the event/todo editor to set quickly the category of an item. |
110 | 113 | ||
111 | 114 | ||
112 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. | 115 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. |
113 | 116 | ||
114 | Added KA/Pi multi sync to the multi sync called from the alarm applet. | 117 | Added KA/Pi multi sync to the multi sync called from the alarm applet. |
115 | 118 | ||
116 | ********** VERSION 2.1.10 ************ | 119 | ********** VERSION 2.1.10 ************ |
117 | 120 | ||
118 | KO/Pi: | 121 | KO/Pi: |
119 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. | 122 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. |
120 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. | 123 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. |
121 | Fixed a bug in searching for a small timerange, i.e. one day. | 124 | Fixed a bug in searching for a small timerange, i.e. one day. |
122 | 125 | ||
123 | KA/Pi: | 126 | KA/Pi: |
124 | Fixed two problems in csv export. | 127 | Fixed two problems in csv export. |
125 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. | 128 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. |
126 | 129 | ||
127 | ********** VERSION 2.1.9 ************ | 130 | ********** VERSION 2.1.9 ************ |
128 | 131 | ||
129 | KO/Pi: | 132 | KO/Pi: |
130 | Fixed some problems of the new search options in the search dialog. | 133 | Fixed some problems of the new search options in the search dialog. |
131 | Fixed some problems in the new resource config options. | 134 | Fixed some problems in the new resource config options. |
132 | 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. | 135 | 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. |
133 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: | 136 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: |
134 | 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. | 137 | 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. |
135 | 138 | ||
136 | Fixed a problem in recurrence range in syncing with DTM. | 139 | Fixed a problem in recurrence range in syncing with DTM. |
137 | 140 | ||
138 | KA/Pi: | 141 | KA/Pi: |
139 | Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) | 142 | Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) |
140 | 143 | ||
141 | PwM/Pi: | 144 | PwM/Pi: |
142 | Added "sec" to the timeout config settings to make it clear the timeout values are seconds. | 145 | Added "sec" to the timeout config settings to make it clear the timeout values are seconds. |
143 | 146 | ||
144 | ********** VERSION 2.1.8 ************ | 147 | ********** VERSION 2.1.8 ************ |
145 | 148 | ||
146 | KO/Pi: | 149 | KO/Pi: |
147 | Added info about the completion state of a todo in the ListView/Searchdialog. | 150 | Added info about the completion state of a todo in the ListView/Searchdialog. |
148 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. | 151 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. |
149 | Fixed some updating problems when changing the filter. | 152 | Fixed some updating problems when changing the filter. |
150 | 153 | ||
151 | KA/Pi: | 154 | KA/Pi: |
152 | In the addressee selection dialog now the formatted name is shown, if not empty. | 155 | In the addressee selection dialog now the formatted name is shown, if not empty. |
153 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. | 156 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. |
154 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. | 157 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. |
155 | 158 | ||
156 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. | 159 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. |
157 | Fixed the sorting for size in the file selector on the Z. | 160 | Fixed the sorting for size in the file selector on the Z. |
158 | 161 | ||
159 | Changed the color selection dialog on the Zaurus to a more user friendly version. | 162 | Changed the color selection dialog on the Zaurus to a more user friendly version. |
160 | 163 | ||
161 | ********** VERSION 2.1.7 ************ | 164 | ********** VERSION 2.1.7 ************ |
162 | 165 | ||
163 | KO/Pi: | 166 | KO/Pi: |
164 | Fixed several problems in the new Resource handling. | 167 | Fixed several problems in the new Resource handling. |
165 | Added more options to the search dialog. | 168 | Added more options to the search dialog. |
166 | Fixed a problem in the Month view. | 169 | Fixed a problem in the Month view. |
167 | Added more options to the dialog when setting a todo to stopped. | 170 | Added more options to the dialog when setting a todo to stopped. |
168 | 171 | ||
169 | Fixed two small problems in KO/Pi Alarm applet. | 172 | Fixed two small problems in KO/Pi Alarm applet. |
170 | 173 | ||
171 | ********** VERSION 2.1.6 ************ | 174 | ********** VERSION 2.1.6 ************ |
172 | 175 | ||
173 | This release is for testing only. | 176 | This release is for testing only. |
174 | 177 | ||
175 | KO/Pi: | 178 | KO/Pi: |
176 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. | 179 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. |
177 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. | 180 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. |
178 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. | 181 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. |
179 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. | 182 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. |
180 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. | 183 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. |
181 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. | 184 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. |
182 | 185 | ||
183 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. | 186 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. |
184 | 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. | 187 | 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. |
185 | Now on every sync the set of calendars is synced which are enabled in the resource view. | 188 | Now on every sync the set of calendars is synced which are enabled in the resource view. |
186 | 189 | ||
187 | A calendar is enabled in the resource view if the "eye" column is checked. | 190 | A calendar is enabled in the resource view if the "eye" column is checked. |
188 | You can set a calendar to be the default for new items( "+" column ). | 191 | You can set a calendar to be the default for new items( "+" column ). |
189 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. | 192 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. |
190 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... | 193 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... |
191 | 194 | ||
192 | 195 | ||
193 | ********** VERSION 2.1.5 ************ | 196 | ********** VERSION 2.1.5 ************ |
194 | 197 | ||
195 | This is the new stable version. | 198 | This is the new stable version. |
196 | Bugfix: | 199 | Bugfix: |
197 | Fixed a problem with agenda popup on the desktop in KO/Pi. | 200 | Fixed a problem with agenda popup on the desktop in KO/Pi. |
198 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. | 201 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. |
199 | Added config option to not display completed todos in agenda view. | 202 | Added config option to not display completed todos in agenda view. |
200 | Addressee view is now using the formatted name, if defined. | 203 | Addressee view is now using the formatted name, if defined. |
201 | That makes it possible to display "lastname, firstname" in that view now. | 204 | That makes it possible to display "lastname, firstname" in that view now. |
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp index 2af436c..79b97e8 100644 --- a/korganizer/koimportoldialog.cpp +++ b/korganizer/koimportoldialog.cpp | |||
@@ -62,420 +62,420 @@ _Application gOlApp; | |||
62 | 62 | ||
63 | QDateTime mDdate2Qdtr( DATE dt) | 63 | QDateTime mDdate2Qdtr( DATE dt) |
64 | { | 64 | { |
65 | COleDateTime odt; | 65 | COleDateTime odt; |
66 | SYSTEMTIME st; | 66 | SYSTEMTIME st; |
67 | odt = dt; | 67 | odt = dt; |
68 | odt.GetAsSystemTime(st); | 68 | odt.GetAsSystemTime(st); |
69 | QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); | 69 | QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); |
70 | return qdt; | 70 | return qdt; |
71 | } | 71 | } |
72 | 72 | ||
73 | class OLEListViewItem : public QCheckListItem | 73 | class OLEListViewItem : public QCheckListItem |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | OLEListViewItem( QListView *parent, QString text ) : | 76 | OLEListViewItem( QListView *parent, QString text ) : |
77 | QCheckListItem( parent, text, QCheckListItem::CheckBox ) { mData = 0; }; | 77 | QCheckListItem( parent, text, QCheckListItem::CheckBox ) { mData = 0; }; |
78 | OLEListViewItem( QListViewItem *after, QString text ) : | 78 | OLEListViewItem( QListViewItem *after, QString text ) : |
79 | QCheckListItem( after, text, QCheckListItem::CheckBox ) { mData = 0; }; | 79 | QCheckListItem( after, text, QCheckListItem::CheckBox ) { mData = 0; }; |
80 | ~OLEListViewItem() {}; | 80 | ~OLEListViewItem() {}; |
81 | void setData( DWORD data ) {mData= data; }; | 81 | void setData( DWORD data ) {mData= data; }; |
82 | DWORD data() { return mData ;}; | 82 | DWORD data() { return mData ;}; |
83 | private: | 83 | private: |
84 | DWORD mData; | 84 | DWORD mData; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | KOImportOLdialog::KOImportOLdialog( const QString &caption, | 87 | KOImportOLdialog::KOImportOLdialog( const QString &caption, |
88 | Calendar *calendar, QWidget *parent ) : | 88 | Calendar *calendar, QWidget *parent ) : |
89 | KDialogBase( Plain, caption, User1 | Close, Ok, | 89 | KDialogBase( Plain, caption, User1 | Close, Ok, |
90 | parent, caption, true, false, i18n("Import!") ) | 90 | parent, caption, true, false, i18n("Import!") ) |
91 | { | 91 | { |
92 | QHBox * mw = new QHBox( this ); | 92 | QHBox * mw = new QHBox( this ); |
93 | setMainWidget( mw ); | 93 | setMainWidget( mw ); |
94 | mListView = new QListView( mw ); | 94 | mListView = new QListView( mw ); |
95 | mListView->addColumn(i18n("Select Folder to import")); | 95 | mListView->addColumn(i18n("Select Folder to import")); |
96 | mListView->addColumn(i18n("Content Type")); | 96 | mListView->addColumn(i18n("Content Type")); |
97 | mCalendar = calendar; | 97 | mCalendar = calendar; |
98 | connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); | 98 | connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); |
99 | setupFolderView(); | 99 | setupFolderView(); |
100 | resize( sizeHint().width()+50, sizeHint().height()+50 ); | 100 | resize( sizeHint().width()+50, sizeHint().height()+50 ); |
101 | } | 101 | } |
102 | 102 | ||
103 | KOImportOLdialog::~KOImportOLdialog() | 103 | KOImportOLdialog::~KOImportOLdialog() |
104 | { | 104 | { |
105 | 105 | ||
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | void KOImportOLdialog::setupFolderView() | 109 | void KOImportOLdialog::setupFolderView() |
110 | { | 110 | { |
111 | SCODE sc = ::OleInitialize(NULL); | 111 | SCODE sc = ::OleInitialize(NULL); |
112 | if ( FAILED ( sc ) ) { | 112 | if ( FAILED ( sc ) ) { |
113 | KMessageBox::information(this,"OLE initialisation failed"); | 113 | KMessageBox::information(this,"OLE initialisation failed"); |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | 116 | ||
117 | if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){ | 117 | if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){ |
118 | KMessageBox::information(this,"Sorry, cannot access Outlook"); | 118 | KMessageBox::information(this,"Sorry, cannot access Outlook"); |
119 | return ; | 119 | return ; |
120 | } | 120 | } |
121 | MAPIFolder mfInbox; | 121 | MAPIFolder mfInbox; |
122 | MAPIFolder mfRoot; | 122 | MAPIFolder mfRoot; |
123 | CString szName; | 123 | CString szName; |
124 | _NameSpace olNS; | 124 | _NameSpace olNS; |
125 | olNS = gOlApp.GetNamespace(_T("MAPI")); | 125 | olNS = gOlApp.GetNamespace(_T("MAPI")); |
126 | mfInbox = olNS.GetDefaultFolder(6); | 126 | mfInbox = olNS.GetDefaultFolder(6); |
127 | mfRoot = mfInbox.GetParent(); | 127 | mfRoot = mfInbox.GetParent(); |
128 | szName = mfRoot.GetName(); | 128 | szName = mfRoot.GetName(); |
129 | long iType = mfRoot.GetDefaultItemType(); | 129 | long iType = mfRoot.GetDefaultItemType(); |
130 | QString mes; | 130 | QString mes; |
131 | mes = QString::fromUcs2( szName.GetBuffer() ); | 131 | mes = QString::fromUcs2( szName.GetBuffer() ); |
132 | OLEListViewItem * root = new OLEListViewItem( mListView, mes ); | 132 | OLEListViewItem * root = new OLEListViewItem( mListView, mes ); |
133 | mfRoot.m_lpDispatch->AddRef(); | 133 | mfRoot.m_lpDispatch->AddRef(); |
134 | addFolder( root, mfRoot.m_lpDispatch ); | 134 | addFolder( root, mfRoot.m_lpDispatch ); |
135 | root->setOpen( true ); | 135 | root->setOpen( true ); |
136 | mListView->setSortColumn( 0 ); | 136 | mListView->setSortColumn( 0 ); |
137 | mListView->sort( ); | 137 | mListView->sort( ); |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) | 141 | void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) |
142 | { | 142 | { |
143 | MAPIFolder mfParent(dispParent), mfChild; | 143 | MAPIFolder mfParent(dispParent), mfChild; |
144 | _Folders folders; | 144 | _Folders folders; |
145 | _variant_t fndx((long)0); | 145 | _variant_t fndx((long)0); |
146 | CString szName; | 146 | CString szName; |
147 | long iType; | 147 | long iType; |
148 | OLEListViewItem* hChild; | 148 | OLEListViewItem* hChild; |
149 | 149 | ||
150 | folders = mfParent.GetFolders(); | 150 | folders = mfParent.GetFolders(); |
151 | for(int i=1; i <= folders.GetCount(); ++i) | 151 | for(int i=1; i <= folders.GetCount(); ++i) |
152 | { | 152 | { |
153 | fndx = (long)i; | 153 | fndx = (long)i; |
154 | mfChild = folders.Item(fndx.Detach()); | 154 | mfChild = folders.Item(fndx.Detach()); |
155 | mfChild.m_lpDispatch->AddRef(); | 155 | mfChild.m_lpDispatch->AddRef(); |
156 | szName = mfChild.GetName(); | 156 | szName = mfChild.GetName(); |
157 | iType = mfChild.GetDefaultItemType(); | 157 | iType = mfChild.GetDefaultItemType(); |
158 | hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); | 158 | hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); |
159 | if ( iType != 1) | 159 | if ( iType != 1) |
160 | hChild->setEnabled( false ); | 160 | hChild->setEnabled( false ); |
161 | QString ts; | 161 | QString ts; |
162 | switch( iType ) { | 162 | switch( iType ) { |
163 | case 0: | 163 | case 0: |
164 | ts = i18n("Mail"); | 164 | ts = i18n("Mail"); |
165 | break; | 165 | break; |
166 | case 1: | 166 | case 1: |
167 | ts = i18n("Calendar"); | 167 | ts = i18n("Calendar"); |
168 | break; | 168 | break; |
169 | case 2: | 169 | case 2: |
170 | ts = i18n("Contacts"); | 170 | ts = i18n("Contacts"); |
171 | break; | 171 | break; |
172 | case 3: | 172 | case 3: |
173 | ts = i18n("Todos"); | 173 | ts = i18n("Todos"); |
174 | break; | 174 | break; |
175 | case 4: | 175 | case 4: |
176 | ts = i18n("Journals"); | 176 | ts = i18n("Journals"); |
177 | break; | 177 | break; |
178 | case 5: | 178 | case 5: |
179 | ts = i18n("Notes"); | 179 | ts = i18n("Notes"); |
180 | break; | 180 | break; |
181 | default: | 181 | default: |
182 | ts = i18n("Unknown"); | 182 | ts = i18n("Unknown"); |
183 | } | 183 | } |
184 | hChild->setText( 1,ts); | 184 | hChild->setText( 1,ts); |
185 | hChild->setData( (DWORD) mfChild.m_lpDispatch ); | 185 | hChild->setData( (DWORD) mfChild.m_lpDispatch ); |
186 | mfChild.m_lpDispatch->AddRef(); | 186 | mfChild.m_lpDispatch->AddRef(); |
187 | addFolder(hChild, mfChild.m_lpDispatch); | 187 | addFolder(hChild, mfChild.m_lpDispatch); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | void KOImportOLdialog::slotApply() | 191 | void KOImportOLdialog::slotApply() |
192 | { | 192 | { |
193 | importedItems = 0; | 193 | importedItems = 0; |
194 | OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); | 194 | OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); |
195 | while ( child ) { | 195 | while ( child ) { |
196 | if ( child->isOn()&& child->data() ) | 196 | if ( child->isOn()&& child->data() ) |
197 | readCalendarData( child->data() ); | 197 | readCalendarData( child->data() ); |
198 | child = (OLEListViewItem*) child->itemBelow(); | 198 | child = (OLEListViewItem*) child->itemBelow(); |
199 | } | 199 | } |
200 | QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); | 200 | QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); |
201 | KMessageBox::information(this,mes); | 201 | KMessageBox::information(this,mes); |
202 | } | 202 | } |
203 | void KOImportOLdialog::readCalendarData( DWORD folder ) | 203 | void KOImportOLdialog::readCalendarData( DWORD folder ) |
204 | { | 204 | { |
205 | 205 | ||
206 | LPDISPATCH dispItem = (LPDISPATCH)folder; | 206 | LPDISPATCH dispItem = (LPDISPATCH)folder; |
207 | dispItem->AddRef(); | 207 | dispItem->AddRef(); |
208 | MAPIFolder mf(dispItem); | 208 | MAPIFolder mf(dispItem); |
209 | mf.m_lpDispatch->AddRef(); | 209 | mf.m_lpDispatch->AddRef(); |
210 | _Items folderItems; | 210 | _Items folderItems; |
211 | _variant_t indx((long)0); | 211 | _variant_t indx((long)0); |
212 | LPDISPATCH itm; | 212 | LPDISPATCH itm; |
213 | int i; | 213 | int i; |
214 | folderItems = mf.GetItems(); | 214 | folderItems = mf.GetItems(); |
215 | QProgressDialog bar( i18n("Importing calendar data"),i18n("Abort"), folderItems.GetCount(),this ); | 215 | QProgressDialog bar( i18n("Importing calendar data"),i18n("Abort"), folderItems.GetCount(),this ); |
216 | bar.setCaption (i18n("Importing!") ); | 216 | bar.setCaption (i18n("Importing!") ); |
217 | int h = bar.sizeHint().height() ; | 217 | int h = bar.sizeHint().height() ; |
218 | int w = 300; | 218 | int w = 300; |
219 | int dw = QApplication::desktop()->width(); | 219 | int dw = QApplication::desktop()->width(); |
220 | int dh = QApplication::desktop()->height(); | 220 | int dh = QApplication::desktop()->height(); |
221 | //bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 221 | //bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
222 | bar.show(); | 222 | bar.show(); |
223 | for(i=1; i <= folderItems.GetCount(); ++i) | 223 | for(i=1; i <= folderItems.GetCount(); ++i) |
224 | { | 224 | { |
225 | qApp->processEvents(); | 225 | qApp->processEvents(); |
226 | if ( ! bar.isVisible() ) | 226 | if ( ! bar.isVisible() ) |
227 | return ; | 227 | return ; |
228 | bar.setProgress( i ); | 228 | bar.setProgress( i ); |
229 | bar.raise(); | 229 | bar.raise(); |
230 | indx = (long)i; | 230 | indx = (long)i; |
231 | itm = folderItems.Item(indx.Detach()); | 231 | itm = folderItems.Item(indx.Detach()); |
232 | _AppointmentItem * pItem = (_AppointmentItem *)&itm; | 232 | _AppointmentItem * pItem = (_AppointmentItem *)&itm; |
233 | ol2kopiCalendar( pItem ); | 233 | ol2kopiCalendar( pItem ); |
234 | itm->Release(); | 234 | itm->Release(); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | void KOImportOLdialog::slotOk() | 237 | void KOImportOLdialog::slotOk() |
238 | { | 238 | { |
239 | QDialog::accept(); | 239 | QDialog::accept(); |
240 | } | 240 | } |
241 | 241 | ||
242 | void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence ) | 242 | void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence ) |
243 | { | 243 | { |
244 | KCal::Event* event = new KCal::Event(); | 244 | KCal::Event* event = new KCal::Event(); |
245 | if ( aItem->GetAllDayEvent() ){ | 245 | if ( aItem->GetAllDayEvent() ){ |
246 | event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) )); | 246 | event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) )); |
247 | event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1)); | 247 | event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1)); |
248 | event->setFloats( true ); | 248 | event->setFloats( true ); |
249 | } else { | 249 | } else { |
250 | event->setDtStart( mDdate2Qdtr( aItem->GetStart()) ); | 250 | event->setDtStart( mDdate2Qdtr( aItem->GetStart()) ); |
251 | event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) ); | 251 | event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) ); |
252 | event->setFloats( false ); | 252 | event->setFloats( false ); |
253 | } | 253 | } |
254 | event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) ); | 254 | event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()).stripWhiteSpace() ); |
255 | event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) ); | 255 | event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()).stripWhiteSpace() ); |
256 | event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()).replace( QRegExp("\\r"), "") ); | 256 | event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()).replace( QRegExp("\\r"), "").stripWhiteSpace() ); |
257 | QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("; "), ";"); | 257 | QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("; "), ";"); |
258 | event->setCategories( QStringList::split( ";", cat ) ); | 258 | event->setCategories( QStringList::split( ";", cat ) ); |
259 | if ( aItem->GetReminderSet() ) { | 259 | if ( aItem->GetReminderSet() ) { |
260 | event->clearAlarms(); | 260 | event->clearAlarms(); |
261 | Alarm* alarm = event->newAlarm(); | 261 | Alarm* alarm = event->newAlarm(); |
262 | alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 ); | 262 | alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 ); |
263 | alarm->setEnabled( true ); | 263 | alarm->setEnabled( true ); |
264 | if ( aItem->GetReminderPlaySound() ) { | 264 | if ( aItem->GetReminderPlaySound() ) { |
265 | alarm->setType( Alarm::Audio ); | 265 | alarm->setType( Alarm::Audio ); |
266 | alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer())); | 266 | alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer())); |
267 | } | 267 | } |
268 | else | 268 | else |
269 | alarm->setType( Alarm::Display ); | 269 | alarm->setType( Alarm::Display ); |
270 | alarm->setRepeatCount( aItem->GetReplyTime() ); | 270 | alarm->setRepeatCount( aItem->GetReplyTime() ); |
271 | } | 271 | } |
272 | // OL :pub 0 - pers 1 - priv 2 - conf 3 | 272 | // OL :pub 0 - pers 1 - priv 2 - conf 3 |
273 | // KO : pub 0 - priv 1 - conf 2 | 273 | // KO : pub 0 - priv 1 - conf 2 |
274 | int sec = aItem->GetSensitivity() ; | 274 | int sec = aItem->GetSensitivity() ; |
275 | if ( sec > 1 )// mapping pers -> private | 275 | if ( sec > 1 )// mapping pers -> private |
276 | --sec; | 276 | --sec; |
277 | event->setSecrecy( sec ); | 277 | event->setSecrecy( sec ); |
278 | if ( aItem->GetBusyStatus() == 0 ) | 278 | if ( aItem->GetBusyStatus() == 0 ) |
279 | event->setTransparency( Event::Transparent);// OL free | 279 | event->setTransparency( Event::Transparent);// OL free |
280 | else | 280 | else |
281 | event->setTransparency( Event::Opaque);//OL all other | 281 | event->setTransparency( Event::Opaque);//OL all other |
282 | 282 | ||
283 | if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur | 283 | if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur |
284 | 284 | ||
285 | RecurrencePattern recpat = aItem->GetRecurrencePattern(); | 285 | RecurrencePattern recpat = aItem->GetRecurrencePattern(); |
286 | 286 | ||
287 | QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date(); | 287 | QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date(); |
288 | int freq = recpat.GetInterval(); | 288 | int freq = recpat.GetInterval(); |
289 | 289 | if ( freq == 0 ) freq = 1; | |
290 | bool hasEndDate = !recpat.GetNoEndDate(); | 290 | bool hasEndDate = !recpat.GetNoEndDate(); |
291 | QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date(); | 291 | QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date(); |
292 | QBitArray weekDays( 7 ); | 292 | QBitArray weekDays( 7 ); |
293 | weekDays.fill(false ); | 293 | weekDays.fill(false ); |
294 | uint weekDaysNum = recpat.GetDayOfWeekMask(); | 294 | uint weekDaysNum = recpat.GetDayOfWeekMask(); |
295 | int i; | 295 | int i; |
296 | int bb = 2; | 296 | int bb = 2; |
297 | for( i = 1; i <= 6; ++i ) { | 297 | for( i = 1; i <= 6; ++i ) { |
298 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); | 298 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); |
299 | bb = 4 << (i-1); | 299 | bb = 4 << (i-1); |
300 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); | 300 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); |
301 | } | 301 | } |
302 | if ( 1 & weekDaysNum) | 302 | if ( 1 & weekDaysNum) |
303 | weekDays.setBit( 6 ); | 303 | weekDays.setBit( 6 ); |
304 | // int pos = 1;// pending | 304 | // int pos = 1;// pending |
305 | 305 | ||
306 | Recurrence *r = event->recurrence(); | 306 | Recurrence *r = event->recurrence(); |
307 | int rtype = recpat.GetRecurrenceType(); | 307 | int rtype = recpat.GetRecurrenceType(); |
308 | //recurrence types are: | 308 | //recurrence types are: |
309 | /* | 309 | /* |
310 | olRecursDaily(0) | 310 | olRecursDaily(0) |
311 | olRecursWeekly(1) | 311 | olRecursWeekly(1) |
312 | olRecursMonthly(2) | 312 | olRecursMonthly(2) |
313 | olRecursMonthNth(3) | 313 | olRecursMonthNth(3) |
314 | olRecursYearly(5) | 314 | olRecursYearly(5) |
315 | olRecursYearNth(6) | 315 | olRecursYearNth(6) |
316 | */ | 316 | */ |
317 | 317 | ||
318 | int duration = recpat.GetOccurrences(); | 318 | int duration = recpat.GetOccurrences(); |
319 | if ( !hasEndDate ) | 319 | if ( !hasEndDate ) |
320 | duration = -1; | 320 | duration = -1; |
321 | 321 | ||
322 | //LPDISPATCH RecurrencePattern::GetExceptions() | 322 | //LPDISPATCH RecurrencePattern::GetExceptions() |
323 | //long RecurrencePattern::GetMonthOfYear() | 323 | //long RecurrencePattern::GetMonthOfYear() |
324 | if ( rtype == 0 ) { | 324 | if ( rtype == 0 ) { |
325 | if ( hasEndDate ) r->setDaily( freq, endDate ); | 325 | if ( hasEndDate ) r->setDaily( freq, endDate ); |
326 | else r->setDaily( freq, duration ); | 326 | else r->setDaily( freq, duration ); |
327 | } else if ( rtype == 1 ) { | 327 | } else if ( rtype == 1 ) { |
328 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); | 328 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); |
329 | else r->setWeekly( freq, weekDays, duration ); | 329 | else r->setWeekly( freq, weekDays, duration ); |
330 | } else if ( rtype == 2 ) { | 330 | } else if ( rtype == 2 ) { |
331 | if ( hasEndDate ) | 331 | if ( hasEndDate ) |
332 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 332 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
333 | else | 333 | else |
334 | r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); | 334 | r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); |
335 | //r->addMonthlyDay( startDate.day() ); | 335 | //r->addMonthlyDay( startDate.day() ); |
336 | r->addMonthlyDay( recpat.GetDayOfMonth() ); | 336 | r->addMonthlyDay( recpat.GetDayOfMonth() ); |
337 | } else if ( rtype == 3 ) { | 337 | } else if ( rtype == 3 ) { |
338 | if ( hasEndDate ) | 338 | if ( hasEndDate ) |
339 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 339 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
340 | else | 340 | else |
341 | r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); | 341 | r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); |
342 | QBitArray days( 7 ); | 342 | QBitArray days( 7 ); |
343 | days.fill( false ); | 343 | days.fill( false ); |
344 | days.setBit( startDate.dayOfWeek() - 1 ); | 344 | days.setBit( startDate.dayOfWeek() - 1 ); |
345 | int pos = (startDate.day()/7)+1; | 345 | int pos = (startDate.day()/7)+1; |
346 | r->addMonthlyPos( pos, days ); | 346 | r->addMonthlyPos( pos, days ); |
347 | //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1); | 347 | //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1); |
348 | //KMessageBox::information(this,mes); | 348 | //KMessageBox::information(this,mes); |
349 | } else if ( rtype == 5 ) { | 349 | } else if ( rtype == 5 ) { |
350 | freq = 1; | 350 | freq = 1; |
351 | if ( hasEndDate ) | 351 | if ( hasEndDate ) |
352 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 352 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
353 | else | 353 | else |
354 | r->setYearly( Recurrence::rYearlyMonth, freq, duration ); | 354 | r->setYearly( Recurrence::rYearlyMonth, freq, duration ); |
355 | r->addYearlyNum( startDate.month() ); | 355 | r->addYearlyNum( startDate.month() ); |
356 | } else if ( true /*rtype == 6*/ ) { | 356 | } else if ( true /*rtype == 6*/ ) { |
357 | // KOganizer cannot handle this in the GUI | 357 | // KOganizer cannot handle this in the GUI |
358 | // we are mapping this to monthly - every 12. month | 358 | // we are mapping this to monthly - every 12. month |
359 | freq = 12; | 359 | freq = 12; |
360 | if ( hasEndDate ) | 360 | if ( hasEndDate ) |
361 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 361 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
362 | else | 362 | else |
363 | r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); | 363 | r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); |
364 | QBitArray days( 7 ); | 364 | QBitArray days( 7 ); |
365 | days.fill( false ); | 365 | days.fill( false ); |
366 | days.setBit( startDate.dayOfWeek() - 1 ); | 366 | days.setBit( startDate.dayOfWeek() - 1 ); |
367 | int pos = (startDate.day()/7)+1; | 367 | int pos = (startDate.day()/7)+1; |
368 | r->addMonthlyPos( pos, days ); | 368 | r->addMonthlyPos( pos, days ); |
369 | } | 369 | } |
370 | // recurrence exceptions | 370 | // recurrence exceptions |
371 | LPDISPATCH dispItem = recpat.GetExceptions(); | 371 | LPDISPATCH dispItem = recpat.GetExceptions(); |
372 | dispItem->AddRef(); | 372 | dispItem->AddRef(); |
373 | Exceptions ex(dispItem); | 373 | Exceptions ex(dispItem); |
374 | _variant_t indx((long)0); | 374 | _variant_t indx((long)0); |
375 | LPDISPATCH itm; | 375 | LPDISPATCH itm; |
376 | for(i=1; i <= ex.GetCount(); ++i) { | 376 | for(i=1; i <= ex.GetCount(); ++i) { |
377 | indx = (long)i; | 377 | indx = (long)i; |
378 | itm = ex.Item( indx.Detach() ); | 378 | itm = ex.Item( indx.Detach() ); |
379 | ::Exception * pItem = (::Exception *)&itm; | 379 | ::Exception * pItem = (::Exception *)&itm; |
380 | event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() ); | 380 | event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() ); |
381 | if ( !pItem->GetDeleted() ) { | 381 | if ( !pItem->GetDeleted() ) { |
382 | LPDISPATCH appIt = pItem->GetAppointmentItem(); | 382 | LPDISPATCH appIt = pItem->GetAppointmentItem(); |
383 | _AppointmentItem * paItem = (_AppointmentItem *)&appIt; | 383 | _AppointmentItem * paItem = (_AppointmentItem *)&appIt; |
384 | ol2kopiCalendar( paItem, false ); | 384 | ol2kopiCalendar( paItem, false ); |
385 | } | 385 | } |
386 | itm->Release(); | 386 | itm->Release(); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | // recurrence ENTE | 389 | // recurrence ENTE |
390 | event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer())); | 390 | event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer())); |
391 | 391 | ||
392 | //GetOptionalAttendees() | 392 | //GetOptionalAttendees() |
393 | //GetRequiredAttendees() | 393 | //GetRequiredAttendees() |
394 | LPDISPATCH dispItem = aItem->GetRecipients(); | 394 | LPDISPATCH dispItem = aItem->GetRecipients(); |
395 | dispItem->AddRef(); | 395 | dispItem->AddRef(); |
396 | _Folders mf(dispItem); | 396 | _Folders mf(dispItem); |
397 | mf.m_lpDispatch->AddRef(); | 397 | mf.m_lpDispatch->AddRef(); |
398 | _variant_t indx((long)0); | 398 | _variant_t indx((long)0); |
399 | LPDISPATCH itm; | 399 | LPDISPATCH itm; |
400 | int i; | 400 | int i; |
401 | QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer()); | 401 | QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer()); |
402 | QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer()); | 402 | QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer()); |
403 | //GetRequiredAttendees() | 403 | //GetRequiredAttendees() |
404 | for(i=1; i <= mf.GetCount(); ++i) { | 404 | for(i=1; i <= mf.GetCount(); ++i) { |
405 | indx = (long)i; | 405 | indx = (long)i; |
406 | itm = mf.Item( indx.Detach() ); | 406 | itm = mf.Item( indx.Detach() ); |
407 | Recipient * pItem = (Recipient *)&itm; | 407 | Recipient * pItem = (Recipient *)&itm; |
408 | 408 | ||
409 | //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 409 | //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
410 | QString name = QString::fromUcs2( pItem->GetName().GetBuffer()); | 410 | QString name = QString::fromUcs2( pItem->GetName().GetBuffer()); |
411 | KCal::Attendee::PartStat stat; | 411 | KCal::Attendee::PartStat stat; |
412 | bool rsvp = false; | 412 | bool rsvp = false; |
413 | switch ( pItem->GetMeetingResponseStatus() ) { | 413 | switch ( pItem->GetMeetingResponseStatus() ) { |
414 | case 0: //not answered | 414 | case 0: //not answered |
415 | rsvp = true; | 415 | rsvp = true; |
416 | case 5: //not answered | 416 | case 5: //not answered |
417 | stat = Attendee::NeedsAction; | 417 | stat = Attendee::NeedsAction; |
418 | break; | 418 | break; |
419 | case 1: //organizer | 419 | case 1: //organizer |
420 | stat = Attendee::Delegated ; | 420 | stat = Attendee::Delegated ; |
421 | break; | 421 | break; |
422 | case 2: //tentative | 422 | case 2: //tentative |
423 | stat = Attendee::Tentative ; | 423 | stat = Attendee::Tentative ; |
424 | break; | 424 | break; |
425 | case 3: //accepted | 425 | case 3: //accepted |
426 | stat = Attendee::Accepted; | 426 | stat = Attendee::Accepted; |
427 | break; | 427 | break; |
428 | case 4: //declined | 428 | case 4: //declined |
429 | stat =Attendee::Declined ; | 429 | stat =Attendee::Declined ; |
430 | break; | 430 | break; |
431 | default: | 431 | default: |
432 | stat = Attendee::NeedsAction ; | 432 | stat = Attendee::NeedsAction ; |
433 | 433 | ||
434 | } | 434 | } |
435 | KCal::Attendee::Role role; | 435 | KCal::Attendee::Role role; |
436 | if ( event->organizer() == name ) | 436 | if ( event->organizer() == name ) |
437 | role = KCal::Attendee::Chair; | 437 | role = KCal::Attendee::Chair; |
438 | else if ( reqAtt.find( name ) >= 0 ) | 438 | else if ( reqAtt.find( name ) >= 0 ) |
439 | role = KCal::Attendee::ReqParticipant; | 439 | role = KCal::Attendee::ReqParticipant; |
440 | else if ( optAtt.find( name ) >= 0 ) | 440 | else if ( optAtt.find( name ) >= 0 ) |
441 | role = KCal::Attendee::OptParticipant; | 441 | role = KCal::Attendee::OptParticipant; |
442 | else | 442 | else |
443 | role = KCal::Attendee::NonParticipant; | 443 | role = KCal::Attendee::NonParticipant; |
444 | QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer()); | 444 | QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer()); |
445 | if( mail.isEmpty() && name.find("@") > 0 ) { | 445 | if( mail.isEmpty() && name.find("@") > 0 ) { |
446 | int kl = name.find("<"); | 446 | int kl = name.find("<"); |
447 | int gr = name.find(">"); | 447 | int gr = name.find(">"); |
448 | if ( kl >= 0 && gr >= 0) { | 448 | if ( kl >= 0 && gr >= 0) { |
449 | mail = name.mid (kl+1, gr - kl -1); | 449 | mail = name.mid (kl+1, gr - kl -1); |
450 | name = name.left( kl ); | 450 | name = name.left( kl ); |
451 | } | 451 | } |
452 | else | 452 | else |
453 | mail = name; | 453 | mail = name; |
454 | } | 454 | } |
455 | mail = mail.stripWhiteSpace(); | 455 | mail = mail.stripWhiteSpace(); |
456 | 456 | ||
457 | QString uid = getUidByEmail( mail ); | 457 | QString uid = getUidByEmail( mail ); |
458 | //uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer()); | 458 | //uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer()); |
459 | KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ; | 459 | KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ; |
460 | event->addAttendee( a , false ); | 460 | event->addAttendee( a , false ); |
461 | itm->Release(); | 461 | itm->Release(); |
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
465 | if ( !mCalendar->addEventNoDup( event )) | 465 | if ( !mCalendar->addEventNoDup( event )) |
466 | delete event; | 466 | delete event; |
467 | else { | 467 | else { |
468 | // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString()); | 468 | // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString()); |
469 | //KMessageBox::information(this,mes); | 469 | //KMessageBox::information(this,mes); |
470 | ++importedItems; | 470 | ++importedItems; |
471 | } | 471 | } |
472 | } | 472 | } |
473 | void KOImportOLdialog::slotCancel() | 473 | void KOImportOLdialog::slotCancel() |
474 | { | 474 | { |
475 | reject(); | 475 | reject(); |
476 | } | 476 | } |
477 | 477 | ||
478 | QString KOImportOLdialog::getUidByEmail( QString email ) | 478 | QString KOImportOLdialog::getUidByEmail( QString email ) |
479 | { | 479 | { |
480 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 480 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
481 | KABC::AddressBook::Iterator it; | 481 | KABC::AddressBook::Iterator it; |