-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 13 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.h | 3 | ||||
-rw-r--r-- | korganizer/koeventeditor.cpp | 1 |
4 files changed, 15 insertions, 6 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 524f6fc..c598214 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,244 +1,248 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.25 ************ | ||
4 | |||
5 | And again fixed some bugs. | ||
6 | |||
3 | ********** VERSION 2.0.24 ************ | 7 | ********** VERSION 2.0.24 ************ |
4 | 8 | ||
5 | Fixed again a lot of small bugs. | 9 | Fixed again a lot of small bugs. |
6 | Some performance optimizations in date navigator. | 10 | Some performance optimizations in date navigator. |
7 | Month view displays now multi days events on top of each cell, such that it is more likely that all multi days items of one event are in the same row. | 11 | Month view displays now multi days events on top of each cell, such that it is more likely that all multi days items of one event are in the same row. |
8 | 12 | ||
9 | ********** VERSION 2.0.23 ************ | 13 | ********** VERSION 2.0.23 ************ |
10 | 14 | ||
11 | Fixed again a lot of small and strange bugs, e.g. the missing toolbar of KA/Pi after a new installation. | 15 | Fixed again a lot of small and strange bugs, e.g. the missing toolbar of KA/Pi after a new installation. |
12 | Fixed the (agenda) layout of KO/Pi on 5500er. | 16 | Fixed the (agenda) layout of KO/Pi on 5500er. |
13 | Some usebility enhancements (e.g. reselection the current item of the todo view after some changes). | 17 | Some usebility enhancements (e.g. reselection the current item of the todo view after some changes). |
14 | 18 | ||
15 | ********** VERSION 2.0.22 ************ | 19 | ********** VERSION 2.0.22 ************ |
16 | 20 | ||
17 | KO/Pi: | 21 | KO/Pi: |
18 | Fix for creating events/todos via the abgenda context menu. | 22 | Fix for creating events/todos via the abgenda context menu. |
19 | Added option to split toolbar to 3 toolbars. | 23 | Added option to split toolbar to 3 toolbars. |
20 | (Toolbar moving s disabled for this option due to a bug in Qt somewhere). | 24 | (Toolbar moving s disabled for this option due to a bug in Qt somewhere). |
21 | Added option to show one small filter-view-toolbar. | 25 | Added option to show one small filter-view-toolbar. |
22 | Added a print option to the desktop version: | 26 | Added a print option to the desktop version: |
23 | Now you can print out the view of the "Event Viewer". | 27 | Now you can print out the view of the "Event Viewer". |
24 | That means you can print all data of one particular event/todo. | 28 | That means you can print all data of one particular event/todo. |
25 | Added scaling options to printout of Event Viewer and What'sNext View. | 29 | Added scaling options to printout of Event Viewer and What'sNext View. |
26 | Fixed some problems in the month view in "week start sunday" mode. | 30 | Fixed some problems in the month view in "week start sunday" mode. |
27 | KA/Pi: | 31 | KA/Pi: |
28 | Added two more config options. | 32 | Added two more config options. |
29 | Fixed resizing problem of address request dialog when orientation was switched. | 33 | Fixed resizing problem of address request dialog when orientation was switched. |
30 | Cleaned up the menu structure. | 34 | Cleaned up the menu structure. |
31 | Fixed some more problems. | 35 | Fixed some more problems. |
32 | 36 | ||
33 | Fixed the annoying problem that scrolling continued after the key was released in KO/Pi Monthview and the KA/Pi views. | 37 | Fixed the annoying problem that scrolling continued after the key was released in KO/Pi Monthview and the KA/Pi views. |
34 | 38 | ||
35 | And, this is a really cool option (Ben did suggest it): | 39 | And, this is a really cool option (Ben did suggest it): |
36 | Now KO/Pi and KA/Pi can be run from a USB stick: | 40 | Now KO/Pi and KA/Pi can be run from a USB stick: |
37 | All data is read from and written to the stick. | 41 | All data is read from and written to the stick. |
38 | You can enable this in the global configure option TAB with: | 42 | You can enable this in the global configure option TAB with: |
39 | Save using LOCAL storage. | 43 | Save using LOCAL storage. |
40 | Just put KDE-Pim/Pi on a memory stick and you can access all your PIM data on every computer with Windows XP. It will work with the ME and Linux versions as well. I will put a memory stick version for teh next stable release online. | 44 | Just put KDE-Pim/Pi on a memory stick and you can access all your PIM data on every computer with Windows XP. It will work with the ME and Linux versions as well. I will put a memory stick version for teh next stable release online. |
41 | 45 | ||
42 | ********** VERSION 2.0.21 ************ | 46 | ********** VERSION 2.0.21 ************ |
43 | 47 | ||
44 | Fixed another SMTP problem in OM/Pi. | 48 | Fixed another SMTP problem in OM/Pi. |
45 | Some small changed in the new datenavigator in KO/Pi. | 49 | Some small changed in the new datenavigator in KO/Pi. |
46 | Changed default setting for new filter in KA/Pi to "exclude categories". | 50 | Changed default setting for new filter in KA/Pi to "exclude categories". |
47 | Changed the default font size for 640x480 display . | 51 | Changed the default font size for 640x480 display . |
48 | Changed popup menu behaviour in agenda and list view. | 52 | Changed popup menu behaviour in agenda and list view. |
49 | Fixed some layout problems of the date label size in the month view. | 53 | Fixed some layout problems of the date label size in the month view. |
50 | Made month view update faster. | 54 | Made month view update faster. |
51 | Made first datenavigator repainting faster. | 55 | Made first datenavigator repainting faster. |
52 | Changed the title of the event/todo edit dialogs. | 56 | Changed the title of the event/todo edit dialogs. |
53 | Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course). | 57 | Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course). |
54 | Many small usebility fixes in KO/Pi. | 58 | Many small usebility fixes in KO/Pi. |
55 | Pressing the "Calendar" button on the Z switches now to the next view in KO/Pi. | 59 | Pressing the "Calendar" button on the Z switches now to the next view in KO/Pi. |
56 | The set of possible "next views" are the views you have toolbar buttons for. | 60 | The set of possible "next views" are the views you have toolbar buttons for. |
57 | 61 | ||
58 | Made alarm sound working on Linux. | 62 | Made alarm sound working on Linux. |
59 | 63 | ||
60 | KO/Pi alarm applet changed: | 64 | KO/Pi alarm applet changed: |
61 | Made buttons in alarm dialog much bigger. | 65 | Made buttons in alarm dialog much bigger. |
62 | Made setting of timer more user friendly by showing the actual timer fire time and making the buttons in the timer settings much bigger. | 66 | Made setting of timer more user friendly by showing the actual timer fire time and making the buttons in the timer settings much bigger. |
63 | The goal was it to make it possible to use a finger tip ( and not the stylus ) on the touchscreen to adjust the settings. | 67 | The goal was it to make it possible to use a finger tip ( and not the stylus ) on the touchscreen to adjust the settings. |
64 | 68 | ||
65 | And because this version is realeased at Easter, I added an Easter-egg: | 69 | And because this version is realeased at Easter, I added an Easter-egg: |
66 | With a new undocumented command you can get a message box about the next alarm. | 70 | With a new undocumented command you can get a message box about the next alarm. |
67 | Good luck to find it! | 71 | Good luck to find it! |
68 | 72 | ||
69 | 73 | ||
70 | 74 | ||
71 | ********** VERSION 2.0.20 ************ | 75 | ********** VERSION 2.0.20 ************ |
72 | 76 | ||
73 | Two small fixes in OM/Pi. | 77 | Two small fixes in OM/Pi. |
74 | 78 | ||
75 | Better resizing of the new datenavigator in KO/Pi. | 79 | Better resizing of the new datenavigator in KO/Pi. |
76 | 80 | ||
77 | ********** VERSION 2.0.19 ************ | 81 | ********** VERSION 2.0.19 ************ |
78 | KO/Pi: | 82 | KO/Pi: |
79 | Enhancements and bugfixes in the new datenavigator. | 83 | Enhancements and bugfixes in the new datenavigator. |
80 | Bugfix in this changelog: | 84 | Bugfix in this changelog: |
81 | The datenavigator was changed in version 2.0.18, not the datepicker. | 85 | The datenavigator was changed in version 2.0.18, not the datepicker. |
82 | 86 | ||
83 | ********** VERSION 2.0.18 ************ | 87 | ********** VERSION 2.0.18 ************ |
84 | KO/Pi: | 88 | KO/Pi: |
85 | Fixed some minor problems. | 89 | Fixed some minor problems. |
86 | Cleaned up the KO/Pi config dialog. | 90 | Cleaned up the KO/Pi config dialog. |
87 | Fixed problem moving events in aganda view. | 91 | Fixed problem moving events in aganda view. |
88 | Made datepicker scaleable, i.e. if the datenavigator shows now a | 92 | Made datepicker scaleable, i.e. if the datenavigator shows now a |
89 | datenavigator matrix depending on its size. | 93 | datenavigator matrix depending on its size. |
90 | Birthdays are now displayed green in the datenavigator. | 94 | Birthdays are now displayed green in the datenavigator. |
91 | What'sThis Help in datenavigator shows all events of the day. | 95 | What'sThis Help in datenavigator shows all events of the day. |
92 | 96 | ||
93 | OM/Pi: | 97 | OM/Pi: |
94 | Updated the backend mail library to the latest version. | 98 | Updated the backend mail library to the latest version. |
95 | Please backup your mail before using this version. | 99 | Please backup your mail before using this version. |
96 | 100 | ||
97 | ********** VERSION 2.0.17 ************ | 101 | ********** VERSION 2.0.17 ************ |
98 | 102 | ||
99 | KO/Pi: | 103 | KO/Pi: |
100 | Tooltips in month view were not sorted. Fixed. | 104 | Tooltips in month view were not sorted. Fixed. |
101 | Daylabel in agenda view ( for display of one day ) was too short. Fixed. | 105 | Daylabel in agenda view ( for display of one day ) was too short. Fixed. |
102 | Conflict display dialog for syncing was not on top of other windows. Fixed. | 106 | Conflict display dialog for syncing was not on top of other windows. Fixed. |
103 | Fixed some minor problems. | 107 | Fixed some minor problems. |
104 | 108 | ||
105 | Fixed an endless loop when importing vcs file with RESOURCES entry. | 109 | Fixed an endless loop when importing vcs file with RESOURCES entry. |
106 | 110 | ||
107 | ********** VERSION 2.0.16 ************ | 111 | ********** VERSION 2.0.16 ************ |
108 | OM/Pi: | 112 | OM/Pi: |
109 | Fixed the SMTP account setting the option. | 113 | Fixed the SMTP account setting the option. |
110 | Fixed something in mail sending. | 114 | Fixed something in mail sending. |
111 | 115 | ||
112 | KO/Pi: | 116 | KO/Pi: |
113 | Added possibility to export selected events/todos as vcal file. | 117 | Added possibility to export selected events/todos as vcal file. |
114 | 118 | ||
115 | ********** VERSION 2.0.15 ************ | 119 | ********** VERSION 2.0.15 ************ |
116 | 120 | ||
117 | PwM/Pi: | 121 | PwM/Pi: |
118 | Added keyboard shorcuts for | 122 | Added keyboard shorcuts for |
119 | - toggling summary view (space bar) | 123 | - toggling summary view (space bar) |
120 | - delete item (delete + backspace key) | 124 | - delete item (delete + backspace key) |
121 | - add new item ( i + n key) | 125 | - add new item ( i + n key) |
122 | Fixed length of info in the title. | 126 | Fixed length of info in the title. |
123 | 127 | ||
124 | KO/Pi-KA/Pi: | 128 | KO/Pi-KA/Pi: |
125 | Changed "ME" menu bar entry to an icon. | 129 | Changed "ME" menu bar entry to an icon. |
126 | 130 | ||
127 | KO/Pi: | 131 | KO/Pi: |
128 | Fixed two minor bugs in displaying todos. | 132 | Fixed two minor bugs in displaying todos. |
129 | If in month view a cell is selected, the key shortcut "d" shows now that date. | 133 | If in month view a cell is selected, the key shortcut "d" shows now that date. |
130 | Added complete info for a todo in month view as an icon left of the text. | 134 | Added complete info for a todo in month view as an icon left of the text. |
131 | Fixed problems of displaying data when "<" or ">" are used in summary/location/description. | 135 | Fixed problems of displaying data when "<" or ">" are used in summary/location/description. |
132 | Fixed problem of search dialog size when switching displays. | 136 | Fixed problem of search dialog size when switching displays. |
133 | Cancel key now closes date picker. | 137 | Cancel key now closes date picker. |
134 | Rearranged KO/Pi file menu structure. | 138 | Rearranged KO/Pi file menu structure. |
135 | 139 | ||
136 | OM/Pi: | 140 | OM/Pi: |
137 | Added to the SMTP account setting the option | 141 | Added to the SMTP account setting the option |
138 | "No secure connection". | 142 | "No secure connection". |
139 | You have to configure your SMTP accounts again, sorry. | 143 | You have to configure your SMTP accounts again, sorry. |
140 | 144 | ||
141 | KA/Pi: | 145 | KA/Pi: |
142 | Added support for importing quoted-printable. | 146 | Added support for importing quoted-printable. |
143 | Support was added by Peter P.. Thanks, Peter! | 147 | Support was added by Peter P.. Thanks, Peter! |
144 | 148 | ||
145 | 149 | ||
146 | ********** VERSION 2.0.14 ************ | 150 | ********** VERSION 2.0.14 ************ |
147 | 151 | ||
148 | Made Passwordmanager PwM/Pi more userfriendly: | 152 | Made Passwordmanager PwM/Pi more userfriendly: |
149 | Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 153 | Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
150 | Fixed bug in KO/Pi todo printing. | 154 | Fixed bug in KO/Pi todo printing. |
151 | Made Qtopia calendar import possible on desktop . | 155 | Made Qtopia calendar import possible on desktop . |
152 | 156 | ||
153 | ********** VERSION 2.0.13 ************ | 157 | ********** VERSION 2.0.13 ************ |
154 | 158 | ||
155 | Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. | 159 | Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. |
156 | 160 | ||
157 | In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". | 161 | In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". |
158 | 162 | ||
159 | OM/Pi: | 163 | OM/Pi: |
160 | Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. | 164 | Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. |
161 | Added missing German translation. | 165 | Added missing German translation. |
162 | Added warning if path is specified in local folder settings of account config. | 166 | Added warning if path is specified in local folder settings of account config. |
163 | 167 | ||
164 | ********** VERSION 2.0.12 ************ | 168 | ********** VERSION 2.0.12 ************ |
165 | 169 | ||
166 | KO/Pi: | 170 | KO/Pi: |
167 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. | 171 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. |
168 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. | 172 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. |
169 | Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. | 173 | Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. |
170 | 174 | ||
171 | Fixed problem in pi-sync mode when wrong password was sent. | 175 | Fixed problem in pi-sync mode when wrong password was sent. |
172 | 176 | ||
173 | OM/Pi: | 177 | OM/Pi: |
174 | Fixed a crash when displaying mails with "Show mail as html" was checked in the config. | 178 | Fixed a crash when displaying mails with "Show mail as html" was checked in the config. |
175 | Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. | 179 | Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. |
176 | 180 | ||
177 | ********** VERSION 2.0.11 ************ | 181 | ********** VERSION 2.0.11 ************ |
178 | 182 | ||
179 | Fixed some problems in pi-sync mode | 183 | Fixed some problems in pi-sync mode |
180 | (e.g. details of events were not synced properly) | 184 | (e.g. details of events were not synced properly) |
181 | 185 | ||
182 | ********** VERSION 2.0.10 ************ | 186 | ********** VERSION 2.0.10 ************ |
183 | 187 | ||
184 | KO/Pi: | 188 | KO/Pi: |
185 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. | 189 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. |
186 | This is fixed. | 190 | This is fixed. |
187 | Changed the search dialog a bit to make it more user friendly. | 191 | Changed the search dialog a bit to make it more user friendly. |
188 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). | 192 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). |
189 | 193 | ||
190 | Added config option to hide the week number in KO/Pi toolbar. | 194 | Added config option to hide the week number in KO/Pi toolbar. |
191 | 195 | ||
192 | ********** VERSION 2.0.9 ************ | 196 | ********** VERSION 2.0.9 ************ |
193 | 197 | ||
194 | Made month view icons for multiday events a bit nicer. | 198 | Made month view icons for multiday events a bit nicer. |
195 | Some minor fixes in KO/Pi | 199 | Some minor fixes in KO/Pi |
196 | (e.g. go to today did not work for new week view properly). | 200 | (e.g. go to today did not work for new week view properly). |
197 | 201 | ||
198 | 202 | ||
199 | ********** VERSION 2.0.8 ************ | 203 | ********** VERSION 2.0.8 ************ |
200 | 204 | ||
201 | Fixed a problem in dependency info in the ipk files for the Zaurus. | 205 | Fixed a problem in dependency info in the ipk files for the Zaurus. |
202 | 206 | ||
203 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. | 207 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. |
204 | 208 | ||
205 | Added a "go today" button to the datepicker. | 209 | Added a "go today" button to the datepicker. |
206 | 210 | ||
207 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) | 211 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) |
208 | and made it configureable to show these values. | 212 | and made it configureable to show these values. |
209 | 213 | ||
210 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. | 214 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. |
211 | 215 | ||
212 | 216 | ||
213 | ********** VERSION 2.0.7 ************ | 217 | ********** VERSION 2.0.7 ************ |
214 | 218 | ||
215 | Added global application font settings | 219 | Added global application font settings |
216 | (for all KDE-Pim/Pi apps) to the general settings. | 220 | (for all KDE-Pim/Pi apps) to the general settings. |
217 | 221 | ||
218 | Fixed a problem in OM/Pi when trying to login to some IMAP servers | 222 | Fixed a problem in OM/Pi when trying to login to some IMAP servers |
219 | (like the IMAP server of Apple: mail.mac.com ) | 223 | (like the IMAP server of Apple: mail.mac.com ) |
220 | 224 | ||
221 | Added recurring todos to KO/Pi. | 225 | Added recurring todos to KO/Pi. |
222 | 226 | ||
223 | 227 | ||
224 | ********** VERSION 2.0.6 ************ | 228 | ********** VERSION 2.0.6 ************ |
225 | 229 | ||
226 | Stable release 2.0.6! | 230 | Stable release 2.0.6! |
227 | 231 | ||
228 | Some bugfixes in the pi-sync mode. | 232 | Some bugfixes in the pi-sync mode. |
229 | Added German translation for pi-sync mode. | 233 | Added German translation for pi-sync mode. |
230 | 234 | ||
231 | KO/Pi: | 235 | KO/Pi: |
232 | Made the todolist using alternate background. | 236 | Made the todolist using alternate background. |
233 | 237 | ||
234 | Other minor fixes in KO/Pi. | 238 | Other minor fixes in KO/Pi. |
235 | 239 | ||
236 | 240 | ||
237 | You can find the complete changelog | 241 | You can find the complete changelog |
238 | from version 1.7.7 to 2.0.5 | 242 | from version 1.7.7 to 2.0.5 |
239 | in the source package or on | 243 | in the source package or on |
240 | 244 | ||
241 | http://www.pi-sync.net/html/changelog.html | 245 | http://www.pi-sync.net/html/changelog.html |
242 | 246 | ||
243 | 247 | ||
244 | 248 | ||
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index abc80d4..f54660f 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -1,500 +1,505 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | 33 | ||
34 | 34 | ||
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | #include <kdebug.h> | 36 | #include <kdebug.h> |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kiconloader.h> | 38 | #include <kiconloader.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | #include <kfiledialog.h> | 40 | #include <kfiledialog.h> |
41 | #include <kstandarddirs.h> | 41 | #include <kstandarddirs.h> |
42 | 42 | ||
43 | #include <libkcal/todo.h> | 43 | #include <libkcal/todo.h> |
44 | #include <libkcal/event.h> | 44 | #include <libkcal/event.h> |
45 | #include <libkdepim/categoryselectdialog.h> | 45 | #include <libkdepim/categoryselectdialog.h> |
46 | #include <libkdepim/kdateedit.h> | 46 | #include <libkdepim/kdateedit.h> |
47 | 47 | ||
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #include "koglobals.h" | 49 | #include "koglobals.h" |
50 | 50 | ||
51 | #include "koeditorgeneral.h" | 51 | #include "koeditorgeneral.h" |
52 | #include "kolocationbox.h" | 52 | #include "kolocationbox.h" |
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #else | 55 | #else |
56 | #include <qapplication.h> | 56 | #include <qapplication.h> |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | 59 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : |
60 | QObject( parent, name) | 60 | QObject( parent, name) |
61 | { | 61 | { |
62 | mNextFocus = 0; | ||
62 | } | 63 | } |
63 | 64 | ||
64 | KOEditorGeneral::~KOEditorGeneral() | 65 | KOEditorGeneral::~KOEditorGeneral() |
65 | { | 66 | { |
66 | } | 67 | } |
67 | 68 | ||
68 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 69 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) |
69 | { | 70 | { |
70 | QGridLayout *headerLayout = new QGridLayout(topLayout); | 71 | QGridLayout *headerLayout = new QGridLayout(topLayout); |
71 | 72 | ||
72 | #if 0 | 73 | #if 0 |
73 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); | 74 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); |
74 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); | 75 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); |
75 | #endif | 76 | #endif |
76 | 77 | ||
77 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); | 78 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); |
78 | headerLayout->addWidget(summaryLabel,1,0); | 79 | headerLayout->addWidget(summaryLabel,1,0); |
79 | 80 | ||
80 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); | 81 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); |
81 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 82 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
82 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); | 83 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); |
83 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); | 84 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); |
84 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; | 85 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; |
85 | if ( QApplication::desktop()->width() > 320 ) | 86 | if ( QApplication::desktop()->width() > 320 ) |
86 | mSummaryEdit->setMaximumHeight( hei +6 ); | 87 | mSummaryEdit->setMaximumHeight( hei +6 ); |
87 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); | 88 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); |
88 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } | 89 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } |
89 | // mSummaryEdit = new QLineEdit(parent); | 90 | // mSummaryEdit = new QLineEdit(parent); |
90 | headerLayout->addWidget(mSummaryEdit,1,1); | 91 | headerLayout->addWidget(mSummaryEdit,1,1); |
91 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 92 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
92 | 93 | ||
93 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); | 94 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); |
94 | headerLayout->addWidget(locationLabel,2,0); | 95 | headerLayout->addWidget(locationLabel,2,0); |
95 | 96 | ||
96 | mLocationEdit = new KOLocationBox(TRUE,parent,10); | 97 | mLocationEdit = new KOLocationBox(TRUE,parent,10); |
97 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 98 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
98 | if ( QApplication::desktop()->width() > 320 ) | 99 | if ( QApplication::desktop()->width() > 320 ) |
99 | mLocationEdit->setMaximumHeight( hei + 6); | 100 | mLocationEdit->setMaximumHeight( hei + 6); |
100 | 101 | ||
101 | // mLocationEdit = new QLineEdit(parent); | 102 | // mLocationEdit = new QLineEdit(parent); |
102 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 103 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
103 | headerLayout->addWidget(mLocationEdit,2,1); | 104 | headerLayout->addWidget(mLocationEdit,2,1); |
104 | headerLayout->setColStretch( 1, 10); | 105 | headerLayout->setColStretch( 1, 10); |
105 | } | 106 | } |
106 | void KOEditorGeneral::setFocusOn( int i ) | 107 | void KOEditorGeneral::setFocusOn( int i ) |
107 | { | 108 | { |
108 | qApp->processEvents(); | 109 | mNextFocus = i; |
109 | if ( i == 1 ) { | 110 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
111 | } | ||
112 | void KOEditorGeneral::slotSetFocusOn() | ||
113 | { | ||
114 | mNextFocus; | ||
115 | if ( mNextFocus == 1 ) { | ||
110 | mDescriptionEdit->setFocus(); | 116 | mDescriptionEdit->setFocus(); |
111 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 117 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
112 | } | 118 | } |
113 | if ( i == 2 ) { | 119 | if ( mNextFocus == 2 ) { |
114 | mSummaryEdit->setFocus(); | 120 | mSummaryEdit->setFocus(); |
115 | } | 121 | } |
116 | |||
117 | } | 122 | } |
118 | void KOEditorGeneral::editCategories() | 123 | void KOEditorGeneral::editCategories() |
119 | { | 124 | { |
120 | // qDebug("KOEditorGeneral::editCategories() "); | 125 | // qDebug("KOEditorGeneral::editCategories() "); |
121 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 126 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
122 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 127 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
123 | //KOGlobals::fitDialogToScreen( csd ); | 128 | //KOGlobals::fitDialogToScreen( csd ); |
124 | csd->setColorEnabled(); | 129 | csd->setColorEnabled(); |
125 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 130 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
126 | csd->exec(); | 131 | csd->exec(); |
127 | delete csd; | 132 | delete csd; |
128 | } | 133 | } |
129 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 134 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) |
130 | { | 135 | { |
131 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 136 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); |
132 | 137 | ||
133 | mCategoriesButton = new QPushButton(parent); | 138 | mCategoriesButton = new QPushButton(parent); |
134 | mCategoriesButton->setText(i18n("Categories...")); | 139 | mCategoriesButton->setText(i18n("Categories...")); |
135 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 140 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
136 | categoriesLayout->addWidget(mCategoriesButton); | 141 | categoriesLayout->addWidget(mCategoriesButton); |
137 | 142 | ||
138 | mCategoriesLabel = new QLabel(parent); | 143 | mCategoriesLabel = new QLabel(parent); |
139 | mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 144 | mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
140 | categoriesLayout->addWidget(mCategoriesLabel,1); | 145 | categoriesLayout->addWidget(mCategoriesLabel,1); |
141 | } | 146 | } |
142 | 147 | ||
143 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) | 148 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) |
144 | { | 149 | { |
145 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); | 150 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); |
146 | 151 | ||
147 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); | 152 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); |
148 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); | 153 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); |
149 | secrecyLayout->addWidget(mCancelBox); | 154 | secrecyLayout->addWidget(mCancelBox); |
150 | secrecyLayout->addWidget(secrecyLabel); | 155 | secrecyLayout->addWidget(secrecyLabel); |
151 | 156 | ||
152 | mSecrecyCombo = new QComboBox(parent); | 157 | mSecrecyCombo = new QComboBox(parent); |
153 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); | 158 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); |
154 | secrecyLayout->addWidget(mSecrecyCombo); | 159 | secrecyLayout->addWidget(mSecrecyCombo); |
155 | } | 160 | } |
156 | 161 | ||
157 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) | 162 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) |
158 | { | 163 | { |
159 | mDescriptionEdit = new KTextEdit(parent); | 164 | mDescriptionEdit = new KTextEdit(parent); |
160 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); | 165 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); |
161 | mDescriptionEdit->append(""); | 166 | mDescriptionEdit->append(""); |
162 | mDescriptionEdit->setReadOnly(false); | 167 | mDescriptionEdit->setReadOnly(false); |
163 | mDescriptionEdit->setOverwriteMode(false); | 168 | mDescriptionEdit->setOverwriteMode(false); |
164 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); | 169 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); |
165 | topLayout->addWidget(mDescriptionEdit); | 170 | topLayout->addWidget(mDescriptionEdit); |
166 | #ifndef DESKTOP_VERSION | 171 | #ifndef DESKTOP_VERSION |
167 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); | 172 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); |
168 | #endif | 173 | #endif |
169 | 174 | ||
170 | } | 175 | } |
171 | 176 | ||
172 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) | 177 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) |
173 | { | 178 | { |
174 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); | 179 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); |
175 | 180 | ||
176 | //mAlarmBell = new QLabel(parent); | 181 | //mAlarmBell = new QLabel(parent); |
177 | //mAlarmBell->setPixmap(SmallIcon("bell")); | 182 | //mAlarmBell->setPixmap(SmallIcon("bell")); |
178 | //alarmLayout->addWidget(mAlarmBell); | 183 | //alarmLayout->addWidget(mAlarmBell); |
179 | if ( QApplication::desktop()->width() < 320 ) | 184 | if ( QApplication::desktop()->width() < 320 ) |
180 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); | 185 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); |
181 | else | 186 | else |
182 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); | 187 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); |
183 | 188 | ||
184 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); | 189 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); |
185 | alarmLayout->addWidget(mAlarmButton); | 190 | alarmLayout->addWidget(mAlarmButton); |
186 | 191 | ||
187 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | 192 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; |
188 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); | 193 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); |
189 | alarmLayout->addWidget(mAlarmTimeEdit); | 194 | alarmLayout->addWidget(mAlarmTimeEdit); |
190 | mAlarmIncrCombo = new QComboBox(false, parent); | 195 | mAlarmIncrCombo = new QComboBox(false, parent); |
191 | if ( QApplication::desktop()->width() < 320 ) { | 196 | if ( QApplication::desktop()->width() < 320 ) { |
192 | mAlarmIncrCombo->insertItem(i18n("min")); | 197 | mAlarmIncrCombo->insertItem(i18n("min")); |
193 | mAlarmIncrCombo->insertItem(i18n("hou")); | 198 | mAlarmIncrCombo->insertItem(i18n("hou")); |
194 | mAlarmIncrCombo->insertItem(i18n("day")); | 199 | mAlarmIncrCombo->insertItem(i18n("day")); |
195 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); | 200 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); |
196 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); | 201 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); |
197 | } else { | 202 | } else { |
198 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | 203 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); |
199 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | 204 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); |
200 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | 205 | mAlarmIncrCombo->insertItem(i18n("day(s)")); |
201 | } | 206 | } |
202 | 207 | ||
203 | // mAlarmIncrCombo->setMinimumHeight(20); | 208 | // mAlarmIncrCombo->setMinimumHeight(20); |
204 | alarmLayout->addWidget(mAlarmIncrCombo); | 209 | alarmLayout->addWidget(mAlarmIncrCombo); |
205 | mAlarmSoundButton = new QPushButton(parent); | 210 | mAlarmSoundButton = new QPushButton(parent); |
206 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | 211 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); |
207 | mAlarmSoundButton->setToggleButton(true); | 212 | mAlarmSoundButton->setToggleButton(true); |
208 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 213 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
209 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 214 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
210 | alarmLayout->addWidget(mAlarmSoundButton); | 215 | alarmLayout->addWidget(mAlarmSoundButton); |
211 | 216 | ||
212 | mAlarmProgramButton = new QPushButton(parent); | 217 | mAlarmProgramButton = new QPushButton(parent); |
213 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 218 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
214 | mAlarmProgramButton->setToggleButton(true); | 219 | mAlarmProgramButton->setToggleButton(true); |
215 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 220 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
216 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 221 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
217 | alarmLayout->addWidget(mAlarmProgramButton); | 222 | alarmLayout->addWidget(mAlarmProgramButton); |
218 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | 223 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); |
219 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | 224 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); |
220 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 225 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
221 | // mAlarmSoundButton->hide(); | 226 | // mAlarmSoundButton->hide(); |
222 | // mAlarmProgramButton->hide(); | 227 | // mAlarmProgramButton->hide(); |
223 | // } | 228 | // } |
224 | } | 229 | } |
225 | 230 | ||
226 | void KOEditorGeneral::pickAlarmSound() | 231 | void KOEditorGeneral::pickAlarmSound() |
227 | { | 232 | { |
228 | 233 | ||
229 | qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); | 234 | qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); |
230 | 235 | ||
231 | bool oldState = mAlarmSoundButton->isOn(); | 236 | bool oldState = mAlarmSoundButton->isOn(); |
232 | 237 | ||
233 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | 238 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, |
234 | i18n("*.wav|Wav Files"), 0)); | 239 | i18n("*.wav|Wav Files"), 0)); |
235 | if (!fileName.isEmpty()) { | 240 | if (!fileName.isEmpty()) { |
236 | mAlarmSound = fileName; | 241 | mAlarmSound = fileName; |
237 | QToolTip::remove(mAlarmSoundButton); | 242 | QToolTip::remove(mAlarmSoundButton); |
238 | QString dispStr = i18n("Playing '%1'").arg(fileName); | 243 | QString dispStr = i18n("Playing '%1'").arg(fileName); |
239 | QToolTip::add(mAlarmSoundButton, dispStr); | 244 | QToolTip::add(mAlarmSoundButton, dispStr); |
240 | mAlarmProgramButton->setOn(false); | 245 | mAlarmProgramButton->setOn(false); |
241 | mAlarmSoundButton->setOn(true); | 246 | mAlarmSoundButton->setOn(true); |
242 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 247 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
243 | } else { | 248 | } else { |
244 | mAlarmProgramButton->setOn(oldState); | 249 | mAlarmProgramButton->setOn(oldState); |
245 | mAlarmSoundButton->setOn(!oldState); | 250 | mAlarmSoundButton->setOn(!oldState); |
246 | 251 | ||
247 | 252 | ||
248 | } | 253 | } |
249 | 254 | ||
250 | if (mAlarmProgramButton->isOn()) | 255 | if (mAlarmProgramButton->isOn()) |
251 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 256 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
252 | if ( mAlarmSoundButton->isOn()) | 257 | if ( mAlarmSoundButton->isOn()) |
253 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 258 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
254 | 259 | ||
255 | } | 260 | } |
256 | 261 | ||
257 | void KOEditorGeneral::pickAlarmProgram() | 262 | void KOEditorGeneral::pickAlarmProgram() |
258 | { | 263 | { |
259 | bool oldState = mAlarmProgramButton->isOn(); | 264 | bool oldState = mAlarmProgramButton->isOn(); |
260 | 265 | ||
261 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | 266 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); |
262 | if (!fileName.isEmpty()) { | 267 | if (!fileName.isEmpty()) { |
263 | mAlarmProgram = fileName; | 268 | mAlarmProgram = fileName; |
264 | QToolTip::remove(mAlarmProgramButton); | 269 | QToolTip::remove(mAlarmProgramButton); |
265 | QString dispStr = i18n("Running '%1'").arg(fileName); | 270 | QString dispStr = i18n("Running '%1'").arg(fileName); |
266 | QToolTip::add(mAlarmProgramButton, dispStr); | 271 | QToolTip::add(mAlarmProgramButton, dispStr); |
267 | mAlarmSoundButton->setOn(false); | 272 | mAlarmSoundButton->setOn(false); |
268 | mAlarmProgramButton->setOn(true); | 273 | mAlarmProgramButton->setOn(true); |
269 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 274 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
270 | } else { | 275 | } else { |
271 | mAlarmProgramButton->setOn(!oldState); | 276 | mAlarmProgramButton->setOn(!oldState); |
272 | mAlarmSoundButton->setOn(oldState); | 277 | mAlarmSoundButton->setOn(oldState); |
273 | } | 278 | } |
274 | 279 | ||
275 | if (mAlarmProgramButton->isOn()) | 280 | if (mAlarmProgramButton->isOn()) |
276 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 281 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
277 | if ( mAlarmSoundButton->isOn()) | 282 | if ( mAlarmSoundButton->isOn()) |
278 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 283 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
279 | 284 | ||
280 | } | 285 | } |
281 | 286 | ||
282 | 287 | ||
283 | QString KOEditorGeneral::getFittingPath( const QString s ) | 288 | QString KOEditorGeneral::getFittingPath( const QString s ) |
284 | { | 289 | { |
285 | int maxlen = 50; | 290 | int maxlen = 50; |
286 | if ( QApplication::desktop()->width() < 640 ) { | 291 | if ( QApplication::desktop()->width() < 640 ) { |
287 | if ( QApplication::desktop()->width() < 320 ) | 292 | if ( QApplication::desktop()->width() < 320 ) |
288 | maxlen = 22; | 293 | maxlen = 22; |
289 | else | 294 | else |
290 | maxlen = 35; | 295 | maxlen = 35; |
291 | } | 296 | } |
292 | if ( s.length() > maxlen ) { | 297 | if ( s.length() > maxlen ) { |
293 | return "..."+s.right(maxlen -3); | 298 | return "..."+s.right(maxlen -3); |
294 | } | 299 | } |
295 | return s; | 300 | return s; |
296 | } | 301 | } |
297 | 302 | ||
298 | void KOEditorGeneral::enableAlarmEdit(bool enable) | 303 | void KOEditorGeneral::enableAlarmEdit(bool enable) |
299 | { | 304 | { |
300 | if ( enable ) { | 305 | if ( enable ) { |
301 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { | 306 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { |
302 | mAlarmSoundButton->setOn( true ); | 307 | mAlarmSoundButton->setOn( true ); |
303 | if ( mAlarmSound.isEmpty() ) | 308 | if ( mAlarmSound.isEmpty() ) |
304 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 309 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
305 | else { | 310 | else { |
306 | if ( ! QFile::exists( mAlarmSound ) ) | 311 | if ( ! QFile::exists( mAlarmSound ) ) |
307 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 312 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
308 | } | 313 | } |
309 | } | 314 | } |
310 | } | 315 | } |
311 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); | 316 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); |
312 | mAlarmTimeEdit->setEnabled(enable); | 317 | mAlarmTimeEdit->setEnabled(enable); |
313 | mAlarmSoundButton->setEnabled(enable); | 318 | mAlarmSoundButton->setEnabled(enable); |
314 | mAlarmProgramButton->setEnabled(enable); | 319 | mAlarmProgramButton->setEnabled(enable); |
315 | mAlarmIncrCombo->setEnabled(enable); | 320 | mAlarmIncrCombo->setEnabled(enable); |
316 | } | 321 | } |
317 | 322 | ||
318 | void KOEditorGeneral::disableAlarmEdit(bool disable) | 323 | void KOEditorGeneral::disableAlarmEdit(bool disable) |
319 | { | 324 | { |
320 | enableAlarmEdit( !disable ); | 325 | enableAlarmEdit( !disable ); |
321 | } | 326 | } |
322 | 327 | ||
323 | void KOEditorGeneral::enableAlarm( bool enable ) | 328 | void KOEditorGeneral::enableAlarm( bool enable ) |
324 | { | 329 | { |
325 | enableAlarmEdit( enable ); | 330 | enableAlarmEdit( enable ); |
326 | } | 331 | } |
327 | 332 | ||
328 | void KOEditorGeneral::alarmDisable(bool disable) | 333 | void KOEditorGeneral::alarmDisable(bool disable) |
329 | { | 334 | { |
330 | if (!disable) { | 335 | if (!disable) { |
331 | //mAlarmBell->setEnabled(true); | 336 | //mAlarmBell->setEnabled(true); |
332 | mAlarmButton->setEnabled(true); | 337 | mAlarmButton->setEnabled(true); |
333 | } else { | 338 | } else { |
334 | //mAlarmBell->setEnabled(false); | 339 | //mAlarmBell->setEnabled(false); |
335 | mAlarmButton->setEnabled(false); | 340 | mAlarmButton->setEnabled(false); |
336 | mAlarmButton->setChecked(false); | 341 | mAlarmButton->setChecked(false); |
337 | mAlarmTimeEdit->setEnabled(false); | 342 | mAlarmTimeEdit->setEnabled(false); |
338 | mAlarmSoundButton->setEnabled(false); | 343 | mAlarmSoundButton->setEnabled(false); |
339 | mAlarmProgramButton->setEnabled(false); | 344 | mAlarmProgramButton->setEnabled(false); |
340 | mAlarmIncrCombo->setEnabled(false); | 345 | mAlarmIncrCombo->setEnabled(false); |
341 | } | 346 | } |
342 | } | 347 | } |
343 | 348 | ||
344 | void KOEditorGeneral::setCategories(const QString &str) | 349 | void KOEditorGeneral::setCategories(const QString &str) |
345 | { | 350 | { |
346 | mCategoriesLabel->setText(str); | 351 | mCategoriesLabel->setText(str); |
347 | } | 352 | } |
348 | 353 | ||
349 | void KOEditorGeneral::setDefaults(bool allDay) | 354 | void KOEditorGeneral::setDefaults(bool allDay) |
350 | { | 355 | { |
351 | #if 0 | 356 | #if 0 |
352 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); | 357 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); |
353 | #endif | 358 | #endif |
354 | 359 | ||
355 | mAlarmMessage = i18n("Edit new item"); | 360 | mAlarmMessage = i18n("Edit new item"); |
356 | enableAlarmEdit( !allDay ); | 361 | enableAlarmEdit( !allDay ); |
357 | 362 | ||
358 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 363 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
359 | int alarmTime; | 364 | int alarmTime; |
360 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 365 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
361 | int index = KOPrefs::instance()->mAlarmTime; | 366 | int index = KOPrefs::instance()->mAlarmTime; |
362 | if (index < 0 || index > 7) { | 367 | if (index < 0 || index > 7) { |
363 | alarmTime = 15; | 368 | alarmTime = 15; |
364 | } else { | 369 | } else { |
365 | alarmTime = a[index]; | 370 | alarmTime = a[index]; |
366 | } | 371 | } |
367 | mAlarmButton ->setChecked( false ); | 372 | mAlarmButton ->setChecked( false ); |
368 | mAlarmTimeEdit->setValue(alarmTime); | 373 | mAlarmTimeEdit->setValue(alarmTime); |
369 | mAlarmIncrCombo->setCurrentItem(0); | 374 | mAlarmIncrCombo->setCurrentItem(0); |
370 | enableAlarmEdit( false ); | 375 | enableAlarmEdit( false ); |
371 | //alarmDisable (false); | 376 | //alarmDisable (false); |
372 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); | 377 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); |
373 | mCancelBox->setChecked( false ); | 378 | mCancelBox->setChecked( false ); |
374 | mSummaryEdit->setEditText(""); | 379 | mSummaryEdit->setEditText(""); |
375 | mLocationEdit->setEditText(""); | 380 | mLocationEdit->setEditText(""); |
376 | mDescriptionEdit->setText(""); | 381 | mDescriptionEdit->setText(""); |
377 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 382 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
378 | setCategories(""); | 383 | setCategories(""); |
379 | } | 384 | } |
380 | void KOEditorGeneral::setSecrecy( int num ) | 385 | void KOEditorGeneral::setSecrecy( int num ) |
381 | { | 386 | { |
382 | mSecrecyCombo->setCurrentItem(num); | 387 | mSecrecyCombo->setCurrentItem(num); |
383 | } | 388 | } |
384 | void KOEditorGeneral::readIncidence(Incidence *event) | 389 | void KOEditorGeneral::readIncidence(Incidence *event) |
385 | { | 390 | { |
386 | 391 | ||
387 | mAlarmMessage = event->summary(); | 392 | mAlarmMessage = event->summary(); |
388 | if ( ! event->location().isEmpty() ) | 393 | if ( ! event->location().isEmpty() ) |
389 | mAlarmMessage += " ("+event->location()+")"; | 394 | mAlarmMessage += " ("+event->location()+")"; |
390 | mAlarmIncrCombo->setCurrentItem(0); | 395 | mAlarmIncrCombo->setCurrentItem(0); |
391 | mSummaryEdit->setEditText(event->summary()); | 396 | mSummaryEdit->setEditText(event->summary()); |
392 | mLocationEdit->setEditText(event->location()); | 397 | mLocationEdit->setEditText(event->location()); |
393 | mDescriptionEdit->setText(event->description()); | 398 | mDescriptionEdit->setText(event->description()); |
394 | 399 | ||
395 | #if 0 | 400 | #if 0 |
396 | // organizer information | 401 | // organizer information |
397 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); | 402 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); |
398 | #endif | 403 | #endif |
399 | 404 | ||
400 | enableAlarmEdit( event->isAlarmEnabled() ); | 405 | enableAlarmEdit( event->isAlarmEnabled() ); |
401 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); | 406 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); |
402 | if(!event->isAlarmEnabled()) { | 407 | if(!event->isAlarmEnabled()) { |
403 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 408 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
404 | int alarmTime; | 409 | int alarmTime; |
405 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 410 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
406 | int index = KOPrefs::instance()->mAlarmTime; | 411 | int index = KOPrefs::instance()->mAlarmTime; |
407 | if (index < 0 || index > 7) { | 412 | if (index < 0 || index > 7) { |
408 | alarmTime = 15; | 413 | alarmTime = 15; |
409 | } else { | 414 | } else { |
410 | alarmTime = a[index]; | 415 | alarmTime = a[index]; |
411 | } | 416 | } |
412 | mAlarmTimeEdit->setValue(alarmTime); | 417 | mAlarmTimeEdit->setValue(alarmTime); |
413 | } | 418 | } |
414 | mAlarmButton->setChecked( event->isAlarmEnabled() ); | 419 | mAlarmButton->setChecked( event->isAlarmEnabled() ); |
415 | mSecrecyCombo->setCurrentItem(event->secrecy()); | 420 | mSecrecyCombo->setCurrentItem(event->secrecy()); |
416 | mCancelBox->setChecked( event->cancelled() ); | 421 | mCancelBox->setChecked( event->cancelled() ); |
417 | mAlarmProgramButton->setOn(false); | 422 | mAlarmProgramButton->setOn(false); |
418 | mAlarmSoundButton->setOn(false); | 423 | mAlarmSoundButton->setOn(false); |
419 | 424 | ||
420 | // set up alarm stuff | 425 | // set up alarm stuff |
421 | QPtrList<Alarm> alarms = event->alarms(); | 426 | QPtrList<Alarm> alarms = event->alarms(); |
422 | Alarm* alarm; | 427 | Alarm* alarm; |
423 | mAlarmIncrCombo->setCurrentItem(0); | 428 | mAlarmIncrCombo->setCurrentItem(0); |
424 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 429 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
425 | int offset; | 430 | int offset; |
426 | if ( alarm->hasTime() ) { | 431 | if ( alarm->hasTime() ) { |
427 | QDateTime t = alarm->time(); | 432 | QDateTime t = alarm->time(); |
428 | offset = event->dtStart().secsTo( t ); | 433 | offset = event->dtStart().secsTo( t ); |
429 | } else { | 434 | } else { |
430 | offset = alarm->startOffset().asSeconds(); | 435 | offset = alarm->startOffset().asSeconds(); |
431 | } | 436 | } |
432 | if ( offset != 0 ) { | 437 | if ( offset != 0 ) { |
433 | offset = offset / -60; // make minutes | 438 | offset = offset / -60; // make minutes |
434 | if (offset % 60 == 0) { // divides evenly into hours? | 439 | if (offset % 60 == 0) { // divides evenly into hours? |
435 | offset = offset / 60; | 440 | offset = offset / 60; |
436 | mAlarmIncrCombo->setCurrentItem(1); | 441 | mAlarmIncrCombo->setCurrentItem(1); |
437 | if (offset % 24 == 0) { // divides evenly into days? | 442 | if (offset % 24 == 0) { // divides evenly into days? |
438 | offset = offset / 24; | 443 | offset = offset / 24; |
439 | mAlarmIncrCombo->setCurrentItem(2); | 444 | mAlarmIncrCombo->setCurrentItem(2); |
440 | } | 445 | } |
441 | } | 446 | } |
442 | } | 447 | } |
443 | mAlarmTimeEdit->setValue( offset ); | 448 | mAlarmTimeEdit->setValue( offset ); |
444 | if (alarm->type() == Alarm::Procedure) { | 449 | if (alarm->type() == Alarm::Procedure) { |
445 | 450 | ||
446 | mAlarmProgram = alarm->programFile(); | 451 | mAlarmProgram = alarm->programFile(); |
447 | mAlarmProgramButton->setOn(true); | 452 | mAlarmProgramButton->setOn(true); |
448 | QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); | 453 | QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); |
449 | QToolTip::add(mAlarmProgramButton, dispStr); | 454 | QToolTip::add(mAlarmProgramButton, dispStr); |
450 | } | 455 | } |
451 | else if (alarm->type() == Alarm::Audio) { | 456 | else if (alarm->type() == Alarm::Audio) { |
452 | mAlarmSound = alarm->audioFile(); | 457 | mAlarmSound = alarm->audioFile(); |
453 | if ( ! QFile::exists( mAlarmSound ) ) | 458 | if ( ! QFile::exists( mAlarmSound ) ) |
454 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 459 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
455 | mAlarmSoundButton->setOn(true); | 460 | mAlarmSoundButton->setOn(true); |
456 | QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); | 461 | QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); |
457 | QToolTip::add(mAlarmSoundButton, dispStr); | 462 | QToolTip::add(mAlarmSoundButton, dispStr); |
458 | } | 463 | } |
459 | mAlarmButton->setChecked(alarm->enabled()); | 464 | mAlarmButton->setChecked(alarm->enabled()); |
460 | enableAlarmEdit( alarm->enabled() ); | 465 | enableAlarmEdit( alarm->enabled() ); |
461 | //qDebug("nableAlarmEdit( alarm->enabled() )********* "); | 466 | //qDebug("nableAlarmEdit( alarm->enabled() )********* "); |
462 | // TODO: Deal with multiple alarms | 467 | // TODO: Deal with multiple alarms |
463 | break; // For now, stop after the first alarm | 468 | break; // For now, stop after the first alarm |
464 | } | 469 | } |
465 | 470 | ||
466 | setCategories(event->categoriesStr()); | 471 | setCategories(event->categoriesStr()); |
467 | } | 472 | } |
468 | 473 | ||
469 | void KOEditorGeneral::writeIncidence(Incidence *event) | 474 | void KOEditorGeneral::writeIncidence(Incidence *event) |
470 | { | 475 | { |
471 | // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; | 476 | // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; |
472 | mLocationEdit->save(KOLocationBox::LOCATION); | 477 | mLocationEdit->save(KOLocationBox::LOCATION); |
473 | event->setSummary(mSummaryEdit->currentText()); | 478 | event->setSummary(mSummaryEdit->currentText()); |
474 | event->setLocation(mLocationEdit->currentText()); | 479 | event->setLocation(mLocationEdit->currentText()); |
475 | event->setDescription(mDescriptionEdit->text()); | 480 | event->setDescription(mDescriptionEdit->text()); |
476 | event->setCategories(mCategoriesLabel->text()); | 481 | event->setCategories(mCategoriesLabel->text()); |
477 | event->setSecrecy(mSecrecyCombo->currentItem()); | 482 | event->setSecrecy(mSecrecyCombo->currentItem()); |
478 | event->setCancelled(mCancelBox->isChecked() );; | 483 | event->setCancelled(mCancelBox->isChecked() );; |
479 | // alarm stuff | 484 | // alarm stuff |
480 | if (mAlarmButton->isChecked()) { | 485 | if (mAlarmButton->isChecked()) { |
481 | if (event->alarms().count() == 0) | 486 | if (event->alarms().count() == 0) |
482 | event->newAlarm(); | 487 | event->newAlarm(); |
483 | QPtrList<Alarm> alarms = event->alarms(); | 488 | QPtrList<Alarm> alarms = event->alarms(); |
484 | Alarm *alarm; | 489 | Alarm *alarm; |
485 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 490 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
486 | alarm->setEnabled(true); | 491 | alarm->setEnabled(true); |
487 | int j = mAlarmTimeEdit->value()* -60; | 492 | int j = mAlarmTimeEdit->value()* -60; |
488 | if (mAlarmIncrCombo->currentItem() == 1) | 493 | if (mAlarmIncrCombo->currentItem() == 1) |
489 | j = j * 60; | 494 | j = j * 60; |
490 | else if (mAlarmIncrCombo->currentItem() == 2) | 495 | else if (mAlarmIncrCombo->currentItem() == 2) |
491 | j = j * (60 * 24); | 496 | j = j * (60 * 24); |
492 | alarm->setStartOffset( j ); | 497 | alarm->setStartOffset( j ); |
493 | 498 | ||
494 | if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { | 499 | if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { |
495 | alarm->setProcedureAlarm(mAlarmProgram); | 500 | alarm->setProcedureAlarm(mAlarmProgram); |
496 | } | 501 | } |
497 | else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) | 502 | else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) |
498 | alarm->setAudioAlarm(mAlarmSound); | 503 | alarm->setAudioAlarm(mAlarmSound); |
499 | else | 504 | else |
500 | alarm->setType(Alarm::Invalid); | 505 | alarm->setType(Alarm::Invalid); |
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h index f4728c7..2069e9c 100644 --- a/korganizer/koeditorgeneral.h +++ b/korganizer/koeditorgeneral.h | |||
@@ -1,114 +1,115 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOEDITORGENERAL_H | 23 | #ifndef KOEDITORGENERAL_H |
24 | #define KOEDITORGENERAL_H | 24 | #define KOEDITORGENERAL_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qgroupbox.h> | 30 | #include <qgroupbox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qlistview.h> | 33 | #include <qlistview.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qspinbox.h> | 36 | #include <qspinbox.h> |
37 | 37 | ||
38 | #include <ktextedit.h> | 38 | #include <ktextedit.h> |
39 | #include <krestrictedline.h> | 39 | #include <krestrictedline.h> |
40 | 40 | ||
41 | #include <libkcal/incidence.h> | 41 | #include <libkcal/incidence.h> |
42 | 42 | ||
43 | #include "ktimeedit.h" | 43 | #include "ktimeedit.h" |
44 | 44 | ||
45 | class KDateEdit; | 45 | class KDateEdit; |
46 | class KOLocationBox; | 46 | class KOLocationBox; |
47 | using namespace KCal; | 47 | using namespace KCal; |
48 | 48 | ||
49 | class KOEditorGeneral : public QObject | 49 | class KOEditorGeneral : public QObject |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | public: | 52 | public: |
53 | KOEditorGeneral (QObject* parent=0,const char* name=0); | 53 | KOEditorGeneral (QObject* parent=0,const char* name=0); |
54 | virtual ~KOEditorGeneral(); | 54 | virtual ~KOEditorGeneral(); |
55 | void setFocusOn( int i ); | 55 | void setFocusOn( int i ); |
56 | void initHeader(QWidget *,QBoxLayout *); | 56 | void initHeader(QWidget *,QBoxLayout *); |
57 | void initDescription(QWidget *,QBoxLayout *); | 57 | void initDescription(QWidget *,QBoxLayout *); |
58 | void initSecrecy(QWidget *,QBoxLayout *); | 58 | void initSecrecy(QWidget *,QBoxLayout *); |
59 | void initCategories(QWidget *,QBoxLayout *); | 59 | void initCategories(QWidget *,QBoxLayout *); |
60 | void initAlarm(QWidget *,QBoxLayout *); | 60 | void initAlarm(QWidget *,QBoxLayout *); |
61 | 61 | ||
62 | /** Set widgets to default values */ | 62 | /** Set widgets to default values */ |
63 | void setDefaults(bool allDay); | 63 | void setDefaults(bool allDay); |
64 | /** Read event object and setup widgets accordingly */ | 64 | /** Read event object and setup widgets accordingly */ |
65 | void readIncidence(Incidence *); | 65 | void readIncidence(Incidence *); |
66 | /** Write event settings to event object */ | 66 | /** Write event settings to event object */ |
67 | void writeIncidence(Incidence *); | 67 | void writeIncidence(Incidence *); |
68 | 68 | ||
69 | /** Check if the input is valid. */ | 69 | /** Check if the input is valid. */ |
70 | bool validateInput() { return true; } | 70 | bool validateInput() { return true; } |
71 | 71 | ||
72 | void enableAlarm( bool enable ); | 72 | void enableAlarm( bool enable ); |
73 | void setSecrecy( int num ); | 73 | void setSecrecy( int num ); |
74 | public slots: | 74 | public slots: |
75 | void setCategories(const QString &); | 75 | void setCategories(const QString &); |
76 | void editCategories(); | 76 | void editCategories(); |
77 | 77 | ||
78 | protected slots: | 78 | protected slots: |
79 | void enableAlarmEdit( bool enable ); | 79 | void enableAlarmEdit( bool enable ); |
80 | void disableAlarmEdit( bool disable ); | 80 | void disableAlarmEdit( bool disable ); |
81 | void alarmDisable( bool disable ); | 81 | void alarmDisable( bool disable ); |
82 | void pickAlarmSound(); | 82 | void pickAlarmSound(); |
83 | void pickAlarmProgram(); | 83 | void pickAlarmProgram(); |
84 | 84 | void slotSetFocusOn(); | |
85 | signals: | 85 | signals: |
86 | void openCategoryDialog(); | 86 | void openCategoryDialog(); |
87 | void allAccepted(); | 87 | void allAccepted(); |
88 | 88 | ||
89 | protected: | 89 | protected: |
90 | int mNextFocus; | ||
90 | //QLineEdit *mSummaryEdit; | 91 | //QLineEdit *mSummaryEdit; |
91 | //QLineEdit *mLocationEdit; | 92 | //QLineEdit *mLocationEdit; |
92 | KOLocationBox *mSummaryEdit; | 93 | KOLocationBox *mSummaryEdit; |
93 | KOLocationBox *mLocationEdit; | 94 | KOLocationBox *mLocationEdit; |
94 | QLabel *mAlarmBell; | 95 | QLabel *mAlarmBell; |
95 | QCheckBox *mAlarmButton; | 96 | QCheckBox *mAlarmButton; |
96 | QSpinBox *mAlarmTimeEdit; | 97 | QSpinBox *mAlarmTimeEdit; |
97 | QPushButton *mAlarmSoundButton; | 98 | QPushButton *mAlarmSoundButton; |
98 | QPushButton *mAlarmProgramButton; | 99 | QPushButton *mAlarmProgramButton; |
99 | QComboBox *mAlarmIncrCombo; | 100 | QComboBox *mAlarmIncrCombo; |
100 | KTextEdit *mDescriptionEdit; | 101 | KTextEdit *mDescriptionEdit; |
101 | QLabel *mOwnerLabel; | 102 | QLabel *mOwnerLabel; |
102 | QComboBox *mSecrecyCombo; | 103 | QComboBox *mSecrecyCombo; |
103 | QCheckBox *mCancelBox; | 104 | QCheckBox *mCancelBox; |
104 | QPushButton *mCategoriesButton; | 105 | QPushButton *mCategoriesButton; |
105 | QLabel *mCategoriesLabel; | 106 | QLabel *mCategoriesLabel; |
106 | 107 | ||
107 | private: | 108 | private: |
108 | QString getFittingPath( const QString ) ; | 109 | QString getFittingPath( const QString ) ; |
109 | QString mAlarmSound; | 110 | QString mAlarmSound; |
110 | QString mAlarmProgram; | 111 | QString mAlarmProgram; |
111 | QString mAlarmMessage; | 112 | QString mAlarmMessage; |
112 | }; | 113 | }; |
113 | 114 | ||
114 | #endif | 115 | #endif |
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp index 337db9b..e23e680 100644 --- a/korganizer/koeventeditor.cpp +++ b/korganizer/koeventeditor.cpp | |||
@@ -1,377 +1,376 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qpixmap.h> | 26 | #include <qpixmap.h> |
27 | #include <qhbox.h> | 27 | #include <qhbox.h> |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | 32 | ||
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | #include <kstandarddirs.h> | 34 | #include <kstandarddirs.h> |
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kfiledialog.h> | 37 | #include <kfiledialog.h> |
38 | #include <kmessagebox.h> | 38 | #include <kmessagebox.h> |
39 | #include <libkcal/calendarresources.h> | 39 | #include <libkcal/calendarresources.h> |
40 | #include <libkcal/resourcecalendar.h> | 40 | #include <libkcal/resourcecalendar.h> |
41 | #include <kresources/resourceselectdialog.h> | 41 | #include <kresources/resourceselectdialog.h> |
42 | 42 | ||
43 | #include <libkdepim/categoryselectdialog.h> | 43 | #include <libkdepim/categoryselectdialog.h> |
44 | #include <libkcal/calendarlocal.h> | 44 | #include <libkcal/calendarlocal.h> |
45 | #include <libkcal/icalformat.h> | 45 | #include <libkcal/icalformat.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koeventeditor.h" | 49 | #include "koeventeditor.h" |
50 | extern int globalFlagBlockAgenda; | 50 | extern int globalFlagBlockAgenda; |
51 | 51 | ||
52 | KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : | 52 | KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : |
53 | KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) | 53 | KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) |
54 | { | 54 | { |
55 | mEvent = 0; | 55 | mEvent = 0; |
56 | init(); | 56 | init(); |
57 | } | 57 | } |
58 | 58 | ||
59 | KOEventEditor::~KOEventEditor() | 59 | KOEventEditor::~KOEventEditor() |
60 | { | 60 | { |
61 | //emit dialogClose( mEvent ); | 61 | //emit dialogClose( mEvent ); |
62 | } | 62 | } |
63 | 63 | ||
64 | void KOEventEditor::init() | 64 | void KOEventEditor::init() |
65 | { | 65 | { |
66 | 66 | ||
67 | setupGeneral(); | 67 | setupGeneral(); |
68 | setupAttendeesTab(); | 68 | setupAttendeesTab(); |
69 | setupRecurrence(); | 69 | setupRecurrence(); |
70 | 70 | ||
71 | // Propagate date time settings to recurrence tab | 71 | // Propagate date time settings to recurrence tab |
72 | connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 72 | connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
73 | mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); | 73 | mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); |
74 | connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), | 74 | connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), |
75 | mRecurrence,SLOT(setDateTimeStr(const QString &))); | 75 | mRecurrence,SLOT(setDateTimeStr(const QString &))); |
76 | 76 | ||
77 | // Category dialog | 77 | // Category dialog |
78 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); | 78 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); |
79 | //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), | 79 | //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), |
80 | // mGeneral,SLOT(setCategories(const QString &))); | 80 | // mGeneral,SLOT(setCategories(const QString &))); |
81 | 81 | ||
82 | 82 | ||
83 | } | 83 | } |
84 | 84 | ||
85 | void KOEventEditor::reload() | 85 | void KOEventEditor::reload() |
86 | { | 86 | { |
87 | if ( mEvent ) readEvent( mEvent ); | 87 | if ( mEvent ) readEvent( mEvent ); |
88 | } | 88 | } |
89 | 89 | ||
90 | void KOEventEditor::setSecrecy( int sec ) | 90 | void KOEventEditor::setSecrecy( int sec ) |
91 | { | 91 | { |
92 | mGeneral->setSecrecy( sec ); | 92 | mGeneral->setSecrecy( sec ); |
93 | } | 93 | } |
94 | void KOEventEditor::setCategories( QString s ) | 94 | void KOEventEditor::setCategories( QString s ) |
95 | { | 95 | { |
96 | mGeneral->setCategories(s); | 96 | mGeneral->setCategories(s); |
97 | 97 | ||
98 | } | 98 | } |
99 | void KOEventEditor::setupGeneral() | 99 | void KOEventEditor::setupGeneral() |
100 | { | 100 | { |
101 | mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); | 101 | mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); |
102 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); | 102 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); |
103 | 103 | ||
104 | if( KOPrefs::instance()->mCompactDialogs ) { | 104 | if( KOPrefs::instance()->mCompactDialogs ) { |
105 | QFrame *topFrame = addPage(i18n("General")); | 105 | QFrame *topFrame = addPage(i18n("General")); |
106 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 106 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
107 | topLayout->setSpacing(spacingHint()-1); | 107 | topLayout->setSpacing(spacingHint()-1); |
108 | topLayout->setMargin(marginHint()-1); | 108 | topLayout->setMargin(marginHint()-1); |
109 | mGeneral->initHeader(topFrame,topLayout); | 109 | mGeneral->initHeader(topFrame,topLayout); |
110 | mGeneral->initTime(topFrame,topLayout); | 110 | mGeneral->initTime(topFrame,topLayout); |
111 | // QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); | 111 | // QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); |
112 | mGeneral->initAlarm(topFrame,topLayout); | 112 | mGeneral->initAlarm(topFrame,topLayout); |
113 | mGeneral->enableAlarm( false ); | 113 | mGeneral->enableAlarm( false ); |
114 | 114 | ||
115 | QBoxLayout *buttonLayout; | 115 | QBoxLayout *buttonLayout; |
116 | if ( QApplication::desktop()->width() < 500 ) | 116 | if ( QApplication::desktop()->width() < 500 ) |
117 | buttonLayout = new QVBoxLayout( topLayout ); | 117 | buttonLayout = new QVBoxLayout( topLayout ); |
118 | else | 118 | else |
119 | buttonLayout = new QHBoxLayout( topLayout ); | 119 | buttonLayout = new QHBoxLayout( topLayout ); |
120 | QHBox* buttonWidget = new QHBox (topFrame); | 120 | QHBox* buttonWidget = new QHBox (topFrame); |
121 | QIconSet icon; | 121 | QIconSet icon; |
122 | if ( QApplication::desktop()->width() < 321 ) | 122 | if ( QApplication::desktop()->width() < 321 ) |
123 | icon = SmallIcon("fileexport16"); | 123 | icon = SmallIcon("fileexport16"); |
124 | else | 124 | else |
125 | icon = SmallIcon("fileexport"); | 125 | icon = SmallIcon("fileexport"); |
126 | QPushButton * loadTemplate = new QPushButton( buttonWidget); | 126 | QPushButton * loadTemplate = new QPushButton( buttonWidget); |
127 | QPushButton * saveTemplate = new QPushButton( buttonWidget); | 127 | QPushButton * saveTemplate = new QPushButton( buttonWidget); |
128 | saveTemplate->setIconSet (icon ) ; | 128 | saveTemplate->setIconSet (icon ) ; |
129 | int size = saveTemplate->sizeHint().height(); | 129 | int size = saveTemplate->sizeHint().height(); |
130 | saveTemplate->setFixedSize( size, size ); | 130 | saveTemplate->setFixedSize( size, size ); |
131 | if ( QApplication::desktop()->width() < 321 ) | 131 | if ( QApplication::desktop()->width() < 321 ) |
132 | icon = SmallIcon("fileimport16"); | 132 | icon = SmallIcon("fileimport16"); |
133 | else | 133 | else |
134 | icon = SmallIcon("fileimport"); | 134 | icon = SmallIcon("fileimport"); |
135 | loadTemplate->setIconSet (icon ) ; | 135 | loadTemplate->setIconSet (icon ) ; |
136 | loadTemplate->setFixedSize( size, size ); | 136 | loadTemplate->setFixedSize( size, size ); |
137 | buttonLayout->addWidget( buttonWidget ); | 137 | buttonLayout->addWidget( buttonWidget ); |
138 | mGeneral->initCategories( topFrame, buttonLayout ); | 138 | mGeneral->initCategories( topFrame, buttonLayout ); |
139 | 139 | ||
140 | topLayout->addStretch( 1 ); | 140 | topLayout->addStretch( 1 ); |
141 | 141 | ||
142 | QFrame *topFrame2 = addPage(i18n("Details")); | 142 | QFrame *topFrame2 = addPage(i18n("Details")); |
143 | 143 | ||
144 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); | 144 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); |
145 | topLayout2->setSpacing(spacingHint()); | 145 | topLayout2->setSpacing(spacingHint()); |
146 | 146 | ||
147 | mGeneral->initClass(topFrame2,topLayout2); | 147 | mGeneral->initClass(topFrame2,topLayout2); |
148 | mGeneral->initSecrecy( topFrame2, topLayout2 ); | 148 | mGeneral->initSecrecy( topFrame2, topLayout2 ); |
149 | mGeneral->initDescription(topFrame2,topLayout2); | 149 | mGeneral->initDescription(topFrame2,topLayout2); |
150 | 150 | ||
151 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 151 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
152 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 152 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
153 | } else { | 153 | } else { |
154 | QFrame *topFrame = addPage(i18n("General")); | 154 | QFrame *topFrame = addPage(i18n("General")); |
155 | 155 | ||
156 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 156 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
157 | topLayout->setSpacing(spacingHint()); | 157 | topLayout->setSpacing(spacingHint()); |
158 | 158 | ||
159 | mGeneral->initHeader(topFrame,topLayout); | 159 | mGeneral->initHeader(topFrame,topLayout); |
160 | mGeneral->initTime(topFrame,topLayout); | 160 | mGeneral->initTime(topFrame,topLayout); |
161 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); | 161 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); |
162 | mGeneral->initAlarm(topFrame,alarmLineLayout); | 162 | mGeneral->initAlarm(topFrame,alarmLineLayout); |
163 | mGeneral->initClass(topFrame,alarmLineLayout); | 163 | mGeneral->initClass(topFrame,alarmLineLayout); |
164 | mGeneral->initDescription(topFrame,topLayout); | 164 | mGeneral->initDescription(topFrame,topLayout); |
165 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); | 165 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); |
166 | mGeneral->initCategories( topFrame, detailsLayout ); | 166 | mGeneral->initCategories( topFrame, detailsLayout ); |
167 | mGeneral->initSecrecy( topFrame, detailsLayout ); | 167 | mGeneral->initSecrecy( topFrame, detailsLayout ); |
168 | } | 168 | } |
169 | 169 | ||
170 | mGeneral->finishSetup(); | 170 | mGeneral->finishSetup(); |
171 | 171 | ||
172 | } | 172 | } |
173 | 173 | ||
174 | void KOEventEditor::setupRecurrence() | 174 | void KOEventEditor::setupRecurrence() |
175 | { | 175 | { |
176 | QFrame *topFrame = addPage( i18n("Recurrence") ); | 176 | QFrame *topFrame = addPage( i18n("Recurrence") ); |
177 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 177 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); |
178 | 178 | ||
179 | mRecurrence = new KOEditorRecurrence( topFrame ); | 179 | mRecurrence = new KOEditorRecurrence( topFrame ); |
180 | topLayout->addWidget( mRecurrence ); | 180 | topLayout->addWidget( mRecurrence ); |
181 | } | 181 | } |
182 | 182 | ||
183 | void KOEventEditor::editEvent(Event *event, bool showDescription) | 183 | void KOEventEditor::editEvent(Event *event, bool showDescription) |
184 | { | 184 | { |
185 | // init(); | 185 | // init(); |
186 | 186 | ||
187 | mEvent = event; | 187 | mEvent = event; |
188 | readEvent(mEvent); | 188 | readEvent(mEvent); |
189 | qApp->processEvents(); | ||
190 | if ( showDescription ) { | 189 | if ( showDescription ) { |
191 | showPage( 1 ); | 190 | showPage( 1 ); |
192 | mGeneral->setFocusOn( 1 ); | 191 | mGeneral->setFocusOn( 1 ); |
193 | } else { | 192 | } else { |
194 | showPage( 0 ); | 193 | showPage( 0 ); |
195 | mGeneral->setFocusOn( 2 ); | 194 | mGeneral->setFocusOn( 2 ); |
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) | 198 | void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) |
200 | { | 199 | { |
201 | // init(); | 200 | // init(); |
202 | 201 | ||
203 | mEvent = 0; | 202 | mEvent = 0; |
204 | setDefaults(from,to,allDay); | 203 | setDefaults(from,to,allDay); |
205 | } | 204 | } |
206 | 205 | ||
207 | void KOEventEditor::loadDefaults() | 206 | void KOEventEditor::loadDefaults() |
208 | { | 207 | { |
209 | int fmt = KOPrefs::instance()->mStartTime; | 208 | int fmt = KOPrefs::instance()->mStartTime; |
210 | 209 | ||
211 | QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); | 210 | QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); |
212 | QDateTime to(QDate::currentDate(), | 211 | QDateTime to(QDate::currentDate(), |
213 | QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); | 212 | QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); |
214 | 213 | ||
215 | setDefaults(from,to,false); | 214 | setDefaults(from,to,false); |
216 | } | 215 | } |
217 | 216 | ||
218 | bool KOEventEditor::processInput( bool emitTime ) | 217 | bool KOEventEditor::processInput( bool emitTime ) |
219 | { | 218 | { |
220 | if (!validateInput()) return false; | 219 | if (!validateInput()) return false; |
221 | 220 | ||
222 | Event *event = 0; | 221 | Event *event = 0; |
223 | 222 | ||
224 | if (mEvent) event = mEvent; | 223 | if (mEvent) event = mEvent; |
225 | else { | 224 | else { |
226 | event = new Event; | 225 | event = new Event; |
227 | event->setOrganizer(KOPrefs::instance()->email()); | 226 | event->setOrganizer(KOPrefs::instance()->email()); |
228 | } | 227 | } |
229 | 228 | ||
230 | writeEvent(event); | 229 | writeEvent(event); |
231 | if ( emitTime ) { | 230 | if ( emitTime ) { |
232 | globalFlagBlockAgenda = 1; | 231 | globalFlagBlockAgenda = 1; |
233 | emit showAgendaView( false ); | 232 | emit showAgendaView( false ); |
234 | emit jumpToTime( event->dtStart().date() ); | 233 | emit jumpToTime( event->dtStart().date() ); |
235 | globalFlagBlockAgenda = 2; | 234 | globalFlagBlockAgenda = 2; |
236 | 235 | ||
237 | } | 236 | } |
238 | if (mEvent) { | 237 | if (mEvent) { |
239 | event->setRevision(event->revision()+1); | 238 | event->setRevision(event->revision()+1); |
240 | emit eventChanged(event); | 239 | emit eventChanged(event); |
241 | } else { | 240 | } else { |
242 | mCalendar->addEvent(event); | 241 | mCalendar->addEvent(event); |
243 | mEvent = event; | 242 | mEvent = event; |
244 | emit eventAdded(event); | 243 | emit eventAdded(event); |
245 | } | 244 | } |
246 | 245 | ||
247 | return true; | 246 | return true; |
248 | } | 247 | } |
249 | 248 | ||
250 | void KOEventEditor::deleteEvent() | 249 | void KOEventEditor::deleteEvent() |
251 | { | 250 | { |
252 | kdDebug() << "Delete event" << endl; | 251 | kdDebug() << "Delete event" << endl; |
253 | 252 | ||
254 | if (mEvent) { | 253 | if (mEvent) { |
255 | if (KOPrefs::instance()->mConfirm) { | 254 | if (KOPrefs::instance()->mConfirm) { |
256 | switch (msgItemDelete()) { | 255 | switch (msgItemDelete()) { |
257 | case KMessageBox::Continue: // OK | 256 | case KMessageBox::Continue: // OK |
258 | emit eventToBeDeleted(mEvent); | 257 | emit eventToBeDeleted(mEvent); |
259 | emit dialogClose(mEvent); | 258 | emit dialogClose(mEvent); |
260 | mCalendar->deleteEvent(mEvent); | 259 | mCalendar->deleteEvent(mEvent); |
261 | emit eventDeleted(); | 260 | emit eventDeleted(); |
262 | reject(); | 261 | reject(); |
263 | break; | 262 | break; |
264 | } | 263 | } |
265 | } | 264 | } |
266 | else { | 265 | else { |
267 | emit eventToBeDeleted(mEvent); | 266 | emit eventToBeDeleted(mEvent); |
268 | emit dialogClose(mEvent); | 267 | emit dialogClose(mEvent); |
269 | mCalendar->deleteEvent(mEvent); | 268 | mCalendar->deleteEvent(mEvent); |
270 | emit eventDeleted(); | 269 | emit eventDeleted(); |
271 | reject(); | 270 | reject(); |
272 | } | 271 | } |
273 | } else { | 272 | } else { |
274 | reject(); | 273 | reject(); |
275 | } | 274 | } |
276 | } | 275 | } |
277 | 276 | ||
278 | void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) | 277 | void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) |
279 | { | 278 | { |
280 | mGeneral->setDefaults(from,to,allDay); | 279 | mGeneral->setDefaults(from,to,allDay); |
281 | mDetails->setDefaults(); | 280 | mDetails->setDefaults(); |
282 | mRecurrence->setDefaults(from,to,allDay); | 281 | mRecurrence->setDefaults(from,to,allDay); |
283 | showPage( 0 ); | 282 | showPage( 0 ); |
284 | mGeneral->setFocusOn( 2 ); | 283 | mGeneral->setFocusOn( 2 ); |
285 | } | 284 | } |
286 | 285 | ||
287 | void KOEventEditor::readEvent( Event *event, bool tmpl ) | 286 | void KOEventEditor::readEvent( Event *event, bool tmpl ) |
288 | { | 287 | { |
289 | mGeneral->readEvent( event, tmpl ); | 288 | mGeneral->readEvent( event, tmpl ); |
290 | mDetails->readEvent( event ); | 289 | mDetails->readEvent( event ); |
291 | mRecurrence->readEvent( event ); | 290 | mRecurrence->readEvent( event ); |
292 | 291 | ||
293 | // categories | 292 | // categories |
294 | //mCategoryDialog->setSelected( event->categories() ); | 293 | //mCategoryDialog->setSelected( event->categories() ); |
295 | } | 294 | } |
296 | 295 | ||
297 | void KOEventEditor::writeEvent(Event *event) | 296 | void KOEventEditor::writeEvent(Event *event) |
298 | { | 297 | { |
299 | mGeneral->writeEvent( event ); | 298 | mGeneral->writeEvent( event ); |
300 | mDetails->writeEvent( event ); | 299 | mDetails->writeEvent( event ); |
301 | 300 | ||
302 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 301 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
303 | Event *ev = new Event( *event ); | 302 | Event *ev = new Event( *event ); |
304 | ev->registerObserver(0); | 303 | ev->registerObserver(0); |
305 | mDetails->cancelAttendeeEvent( ev ); | 304 | mDetails->cancelAttendeeEvent( ev ); |
306 | if ( ev->attendeeCount() > 0 ) { | 305 | if ( ev->attendeeCount() > 0 ) { |
307 | emit deleteAttendee( ev ); | 306 | emit deleteAttendee( ev ); |
308 | } | 307 | } |
309 | delete(ev); | 308 | delete(ev); |
310 | } | 309 | } |
311 | 310 | ||
312 | mRecurrence->writeEvent(event); | 311 | mRecurrence->writeEvent(event); |
313 | } | 312 | } |
314 | 313 | ||
315 | bool KOEventEditor::validateInput() | 314 | bool KOEventEditor::validateInput() |
316 | { | 315 | { |
317 | if (!mGeneral->validateInput()) return false; | 316 | if (!mGeneral->validateInput()) return false; |
318 | if (!mDetails->validateInput()) return false; | 317 | if (!mDetails->validateInput()) return false; |
319 | if (!mRecurrence->validateInput()) return false; | 318 | if (!mRecurrence->validateInput()) return false; |
320 | return true; | 319 | return true; |
321 | } | 320 | } |
322 | 321 | ||
323 | int KOEventEditor::msgItemDelete() | 322 | int KOEventEditor::msgItemDelete() |
324 | { | 323 | { |
325 | return KMessageBox::warningContinueCancel(this, | 324 | return KMessageBox::warningContinueCancel(this, |
326 | i18n("This item will be permanently deleted."), | 325 | i18n("This item will be permanently deleted."), |
327 | i18n("KOrganizer Confirmation"),i18n("Delete")); | 326 | i18n("KOrganizer Confirmation"),i18n("Delete")); |
328 | } | 327 | } |
329 | 328 | ||
330 | void KOEventEditor::slotLoadTemplate() | 329 | void KOEventEditor::slotLoadTemplate() |
331 | { | 330 | { |
332 | 331 | ||
333 | QString fileName =locateLocal( "templates", "events" ); | 332 | QString fileName =locateLocal( "templates", "events" ); |
334 | QDir t_dir; | 333 | QDir t_dir; |
335 | if ( !t_dir.exists(fileName) ) | 334 | if ( !t_dir.exists(fileName) ) |
336 | t_dir.mkdir ( fileName ); | 335 | t_dir.mkdir ( fileName ); |
337 | fileName += "/event"; | 336 | fileName += "/event"; |
338 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this ); | 337 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this ); |
339 | if ( fileName.length() == 0 ) | 338 | if ( fileName.length() == 0 ) |
340 | return; | 339 | return; |
341 | CalendarLocal cal; | 340 | CalendarLocal cal; |
342 | ICalFormat format; | 341 | ICalFormat format; |
343 | if ( !format.load( &cal, fileName ) ) { | 342 | if ( !format.load( &cal, fileName ) ) { |
344 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 343 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
345 | .arg( fileName ) ); | 344 | .arg( fileName ) ); |
346 | return ; | 345 | return ; |
347 | } | 346 | } |
348 | QPtrList<Event> events = cal.events(); | 347 | QPtrList<Event> events = cal.events(); |
349 | Event* event = events.first(); | 348 | Event* event = events.first(); |
350 | if ( !event ) { | 349 | if ( !event ) { |
351 | KMessageBox::error( this, | 350 | KMessageBox::error( this, |
352 | i18n("Template does not contain\na valid Event.")); | 351 | i18n("Template does not contain\na valid Event.")); |
353 | } else { | 352 | } else { |
354 | kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl; | 353 | kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl; |
355 | readEvent( event, true ); | 354 | readEvent( event, true ); |
356 | } | 355 | } |
357 | } | 356 | } |
358 | 357 | ||
359 | 358 | ||
360 | void KOEventEditor::slotSaveTemplate() | 359 | void KOEventEditor::slotSaveTemplate() |
361 | { | 360 | { |
362 | QString fileName =locateLocal( "templates", "events" ); | 361 | QString fileName =locateLocal( "templates", "events" ); |
363 | QDir t_dir; | 362 | QDir t_dir; |
364 | if ( !t_dir.exists(fileName) ) | 363 | if ( !t_dir.exists(fileName) ) |
365 | t_dir.mkdir ( fileName ); | 364 | t_dir.mkdir ( fileName ); |
366 | fileName += "/event"; | 365 | fileName += "/event"; |
367 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Event template"), this ); | 366 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Event template"), this ); |
368 | if ( fileName.length() > 0 ) | 367 | if ( fileName.length() > 0 ) |
369 | saveTemplate( fileName ); | 368 | saveTemplate( fileName ); |
370 | } | 369 | } |
371 | 370 | ||
372 | void KOEventEditor::saveTemplate( const QString &templateName ) | 371 | void KOEventEditor::saveTemplate( const QString &templateName ) |
373 | { | 372 | { |
374 | Event *event = new Event; | 373 | Event *event = new Event; |
375 | writeEvent( event ); | 374 | writeEvent( event ); |
376 | saveAsTemplate( event, templateName ); | 375 | saveAsTemplate( event, templateName ); |
377 | } | 376 | } |