-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | korganizer/koeditorgeneralevent.cpp | 17 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 12 | ||||
-rw-r--r-- | korganizer/ktimeedit.cpp | 106 | ||||
-rw-r--r-- | korganizer/ktimeedit.h | 3 | ||||
-rw-r--r-- | microkde/kdecore/klocale.cpp | 4 |
6 files changed, 33 insertions, 114 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index c8293b2..5d8ef41 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,732 +1,737 @@ | |||
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 1.9.18 ************ | 3 | ********** VERSION 1.9.18 ************ |
4 | 4 | ||
5 | FYI: The VERSION 1.9.17 was a testing release only. | 5 | FYI: The VERSION 1.9.17 was a testing release only. |
6 | Please read the changelog of VERSION 1.9.17 as well. | 6 | Please read the changelog of VERSION 1.9.17 as well. |
7 | 7 | ||
8 | Cleaned up the syncing config dialog. | 8 | Cleaned up the syncing config dialog. |
9 | Added sync config options for date range for events. | 9 | Added sync config options for date range for events. |
10 | Added sync config options for filters on incoming data. | 10 | Added sync config options for filters on incoming data. |
11 | Added sync config options for filters on outgoing data. | 11 | Added sync config options for filters on outgoing data. |
12 | Please read the updated SyncHowTo about the new filter settings. | 12 | Please read the updated SyncHowTo about the new filter settings. |
13 | These filter settings make it now possible to sync with shared | 13 | These filter settings make it now possible to sync with shared |
14 | calendars without writing back private or confidential data | 14 | calendars without writing back private or confidential data |
15 | (via the outgoing filters). | 15 | (via the outgoing filters). |
16 | To sync only with particular parts of a shared calendar, | 16 | To sync only with particular parts of a shared calendar, |
17 | the incoming filter settings can be used. | 17 | the incoming filter settings can be used. |
18 | An example can be found in the SyncHowTo. | 18 | An example can be found in the SyncHowTo. |
19 | |||
20 | KO/Pi: | ||
21 | The timeedit input has a pulldown list for times. | ||
22 | If opened, this pulldown list should now has the right time highlighted. | ||
23 | |||
19 | 24 | ||
20 | 25 | ||
21 | ********** VERSION 1.9.17 ************ | 26 | ********** VERSION 1.9.17 ************ |
22 | 27 | ||
23 | KO/Pi: | 28 | KO/Pi: |
24 | Fixed that tooltips were not updated after moving an item in agenda view. | 29 | Fixed that tooltips were not updated after moving an item in agenda view. |
25 | Fixed a bug in sorting start date for recurring events in list view. | 30 | Fixed a bug in sorting start date for recurring events in list view. |
26 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 31 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
27 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. | 32 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. |
28 | Added more info in the todo viewer: Startdate, parent/sub todos. | 33 | Added more info in the todo viewer: Startdate, parent/sub todos. |
29 | 34 | ||
30 | 35 | ||
31 | KA/Pi: | 36 | KA/Pi: |
32 | All fields search does now actually search all the (possible) fields, | 37 | All fields search does now actually search all the (possible) fields, |
33 | not only those listed in the contact list. | 38 | not only those listed in the contact list. |
34 | Made is possible to inline a picture in a vcard on the Z. | 39 | Made is possible to inline a picture in a vcard on the Z. |
35 | This was only possible on the desktop, now is it possible on the Z as well. | 40 | This was only possible on the desktop, now is it possible on the Z as well. |
36 | Fixed of missing save settings after filter configuration. | 41 | Fixed of missing save settings after filter configuration. |
37 | Made saving of addressbook much faster. | 42 | Made saving of addressbook much faster. |
38 | Fixed extension widget layout problem. | 43 | Fixed extension widget layout problem. |
39 | Fixed saving of default formatted name settings. | 44 | Fixed saving of default formatted name settings. |
40 | Fixed formatted name handling in edit dialog. | 45 | Fixed formatted name handling in edit dialog. |
41 | Added an option for changing formatted names of many contacts | 46 | Added an option for changing formatted names of many contacts |
42 | (menu: File - Change - Set formatted name). | 47 | (menu: File - Change - Set formatted name). |
43 | 48 | ||
44 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 49 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
45 | This is Fixed. | 50 | This is Fixed. |
46 | 51 | ||
47 | KDE-Sync: | 52 | KDE-Sync: |
48 | Now readonly KDE resources are synced as well. | 53 | Now readonly KDE resources are synced as well. |
49 | (They are not changed in KDE itself, of course). | 54 | (They are not changed in KDE itself, of course). |
50 | 55 | ||
51 | 56 | ||
52 | 57 | ||
53 | ********** VERSION 1.9.16 ************ | 58 | ********** VERSION 1.9.16 ************ |
54 | 59 | ||
55 | KO/Pi: | 60 | KO/Pi: |
56 | Fixed search dialog size on Z 6000 (480x640 display). | 61 | Fixed search dialog size on Z 6000 (480x640 display). |
57 | Added setting to hide/show time in agenda items. | 62 | Added setting to hide/show time in agenda items. |
58 | Added setting to hide not running todos in todo view. | 63 | Added setting to hide not running todos in todo view. |
59 | Added columns for start date/time in todo view. | 64 | Added columns for start date/time in todo view. |
60 | Replaced the solid half-hour lines in agenda view by dot lines. | 65 | Replaced the solid half-hour lines in agenda view by dot lines. |
61 | Added possibility of printing the What's Next View on the desktop | 66 | Added possibility of printing the What's Next View on the desktop |
62 | (i.e. Windows and Linux). | 67 | (i.e. Windows and Linux). |
63 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 68 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
64 | Added tooltips in month view.(Tooltips only available on desktop) | 69 | Added tooltips in month view.(Tooltips only available on desktop) |
65 | 70 | ||
66 | Fixed a strange problem in KO/Pi alarm applet. | 71 | Fixed a strange problem in KO/Pi alarm applet. |
67 | Did not find the actual problem, | 72 | Did not find the actual problem, |
68 | such that now Qtopia reboots again if deinstalling the alarm applet. | 73 | such that now Qtopia reboots again if deinstalling the alarm applet. |
69 | But the alarm applet should work again. | 74 | But the alarm applet should work again. |
70 | 75 | ||
71 | KA/Pi: | 76 | KA/Pi: |
72 | Fixed the problem, that internal pictures were not saved. | 77 | Fixed the problem, that internal pictures were not saved. |
73 | 78 | ||
74 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 79 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
75 | 80 | ||
76 | Fixed some minor problems. (Like word wrap in help text windows). | 81 | Fixed some minor problems. (Like word wrap in help text windows). |
77 | 82 | ||
78 | Fixed a compiling problem in microkde/kresources. | 83 | Fixed a compiling problem in microkde/kresources. |
79 | 84 | ||
80 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 85 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
81 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 86 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
82 | such that now syncing KO/Pi with Sharp DTM should work on the | 87 | such that now syncing KO/Pi with Sharp DTM should work on the |
83 | Zaurus C 3000 model. | 88 | Zaurus C 3000 model. |
84 | 89 | ||
85 | ********** VERSION 1.9.15 ************ | 90 | ********** VERSION 1.9.15 ************ |
86 | 91 | ||
87 | Usebilty enhancements in KO/Pi: | 92 | Usebilty enhancements in KO/Pi: |
88 | When clicking on the date in a month view cell, the day view is shown. | 93 | When clicking on the date in a month view cell, the day view is shown. |
89 | Old behaviour was, that the "new event" dialog popped up. | 94 | Old behaviour was, that the "new event" dialog popped up. |
90 | 95 | ||
91 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 96 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
92 | That means, you can restore the latest | 97 | That means, you can restore the latest |
93 | event/todo/journal you have deleted. | 98 | event/todo/journal you have deleted. |
94 | A journal is deleted, if you clear all the text of the journal. | 99 | A journal is deleted, if you clear all the text of the journal. |
95 | 100 | ||
96 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 101 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
97 | 102 | ||
98 | KA/Pi starting in 480x640 resolution: | 103 | KA/Pi starting in 480x640 resolution: |
99 | Hide the filter action in toolbar | 104 | Hide the filter action in toolbar |
100 | and added icons for undo/delete/redo in toolbar. | 105 | and added icons for undo/delete/redo in toolbar. |
101 | 106 | ||
102 | Change in OM/Pi ViewMail dialog: | 107 | Change in OM/Pi ViewMail dialog: |
103 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 108 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
104 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 109 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
105 | 110 | ||
106 | Fixed a crash when deleting mail-accounts in OM/Pi. | 111 | Fixed a crash when deleting mail-accounts in OM/Pi. |
107 | 112 | ||
108 | 113 | ||
109 | ********** VERSION 1.9.14 ************ | 114 | ********** VERSION 1.9.14 ************ |
110 | 115 | ||
111 | Fixed some problems with the dialog sizes when switching | 116 | Fixed some problems with the dialog sizes when switching |
112 | portrait/landscape mode on 640x480 PDA display. | 117 | portrait/landscape mode on 640x480 PDA display. |
113 | 118 | ||
114 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 119 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
115 | 120 | ||
116 | Fixed an ugly bug in KOpieMail: | 121 | Fixed an ugly bug in KOpieMail: |
117 | KOpieMail was not able to write files (mails) to MSDOS file system, | 122 | KOpieMail was not able to write files (mails) to MSDOS file system, |
118 | like on an usual preformatted SD card. That should work now. | 123 | like on an usual preformatted SD card. That should work now. |
119 | To save your mail data on the Sd card do the following: | 124 | To save your mail data on the Sd card do the following: |
120 | Create a dir on the SD card: | 125 | Create a dir on the SD card: |
121 | mkdir /mnt/card/localmail | 126 | mkdir /mnt/card/localmail |
122 | Go to your home dir: | 127 | Go to your home dir: |
123 | cd | 128 | cd |
124 | Go to kopiemail data storage dir: | 129 | Go to kopiemail data storage dir: |
125 | cd kdepim/apps/kopiemail | 130 | cd kdepim/apps/kopiemail |
126 | Create a symlink to the SD card: | 131 | Create a symlink to the SD card: |
127 | ls -s /mnt/card/localmail | 132 | ls -s /mnt/card/localmail |
128 | Now KOpieMail will store all mails on the SD card. | 133 | Now KOpieMail will store all mails on the SD card. |
129 | 134 | ||
130 | KO/Pi Monthview: | 135 | KO/Pi Monthview: |
131 | Now "Go to Today" selects the current month from day 1-end, | 136 | Now "Go to Today" selects the current month from day 1-end, |
132 | not the current date + some days. | 137 | not the current date + some days. |
133 | I.e. "Go to Today" shows now always | 138 | I.e. "Go to Today" shows now always |
134 | the current month with first day of month in the first row. | 139 | the current month with first day of month in the first row. |
135 | 140 | ||
136 | Added missing German translation. | 141 | Added missing German translation. |
137 | 142 | ||
138 | Fixed icons of executeable on Wintendo. | 143 | Fixed icons of executeable on Wintendo. |
139 | 144 | ||
140 | Added a "Show next Mail" button to the OM/Pi | 145 | Added a "Show next Mail" button to the OM/Pi |
141 | mail viewer such that the mail below the current mail | 146 | mail viewer such that the mail below the current mail |
142 | in the mail list view of the current folder | 147 | in the mail list view of the current folder |
143 | can be read with a single click. | 148 | can be read with a single click. |
144 | 149 | ||
145 | 150 | ||
146 | ********** VERSION 1.9.13 ************ | 151 | ********** VERSION 1.9.13 ************ |
147 | 152 | ||
148 | Fixed nasty PwM/Pi file reading bug, when | 153 | Fixed nasty PwM/Pi file reading bug, when |
149 | the used hash algo of file is different then the global | 154 | the used hash algo of file is different then the global |
150 | hash algo. | 155 | hash algo. |
151 | 156 | ||
152 | Added KA/Pi support for opie mailit mailapplication. | 157 | Added KA/Pi support for opie mailit mailapplication. |
153 | 158 | ||
154 | Fixed some bugs in OM/Pi. | 159 | Fixed some bugs in OM/Pi. |
155 | Now character conversion tables are available for the Zaurus | 160 | Now character conversion tables are available for the Zaurus |
156 | to make OM/Pi working properly. | 161 | to make OM/Pi working properly. |
157 | To get the character conversion in OM/Pi working, please download | 162 | To get the character conversion in OM/Pi working, please download |
158 | at the sourceforge project site the package | 163 | at the sourceforge project site the package |
159 | sr-character-conversion_SharpROM_arm.ipk.zip | 164 | sr-character-conversion_SharpROM_arm.ipk.zip |
160 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 165 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
161 | from the section "general files for KDE/Pim" | 166 | from the section "general files for KDE/Pim" |
162 | Instructions how to install this package are in a ReadMe in this file. | 167 | Instructions how to install this package are in a ReadMe in this file. |
163 | 168 | ||
164 | 169 | ||
165 | Fixed the orientation change problem in KA/Pi when switching | 170 | Fixed the orientation change problem in KA/Pi when switching |
166 | portrait/landscape mode. | 171 | portrait/landscape mode. |
167 | 172 | ||
168 | French translation available for KA/Pi and OM/Pi. | 173 | French translation available for KA/Pi and OM/Pi. |
169 | 174 | ||
170 | Fixed some problems with categories in KO/Pi in DTM sync. | 175 | Fixed some problems with categories in KO/Pi in DTM sync. |
171 | 176 | ||
172 | Added selection dialog for export to phone in KA/Pi. | 177 | Added selection dialog for export to phone in KA/Pi. |
173 | 178 | ||
174 | If in KO/Pi is an attendee selected to add to a meeting and this | 179 | If in KO/Pi is an attendee selected to add to a meeting and this |
175 | attendee is already in the list of attendees, this person is not added | 180 | attendee is already in the list of attendees, this person is not added |
176 | again. | 181 | again. |
177 | 182 | ||
178 | Some menu cleanup in KA/Pi. | 183 | Some menu cleanup in KA/Pi. |
179 | 184 | ||
180 | ********** VERSION 1.9.12 ************ | 185 | ********** VERSION 1.9.12 ************ |
181 | 186 | ||
182 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 187 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
183 | 188 | ||
184 | Bugfix: Licence file is now shown again. | 189 | Bugfix: Licence file is now shown again. |
185 | 190 | ||
186 | OM/Pi now supports Unicode (utf8 charset). | 191 | OM/Pi now supports Unicode (utf8 charset). |
187 | Fixed some bugs in OM/Pi. | 192 | Fixed some bugs in OM/Pi. |
188 | 193 | ||
189 | KA/Pi has more German translation. | 194 | KA/Pi has more German translation. |
190 | 195 | ||
191 | 196 | ||
192 | ********** VERSION 1.9.11 ************ | 197 | ********** VERSION 1.9.11 ************ |
193 | 198 | ||
194 | Fixed several problems in PWM/Pi, like | 199 | Fixed several problems in PWM/Pi, like |
195 | asking the user, if unsaved changed are pending | 200 | asking the user, if unsaved changed are pending |
196 | when closing the app. | 201 | when closing the app. |
197 | And PwM/Pi handles now different texts for the | 202 | And PwM/Pi handles now different texts for the |
198 | fields Description, Username, Password, configurable per category. | 203 | fields Description, Username, Password, configurable per category. |
199 | 204 | ||
200 | Fixed a crash in KO/Pi , when importing/loading vcs files | 205 | Fixed a crash in KO/Pi , when importing/loading vcs files |
201 | which have an entry with an attendee with state: | 206 | which have an entry with an attendee with state: |
202 | NEEDS ACTION | 207 | NEEDS ACTION |
203 | 208 | ||
204 | Fixed some problems in the German translation of OM/Pi, | 209 | Fixed some problems in the German translation of OM/Pi, |
205 | which makes some dialogs not fitting on the screen | 210 | which makes some dialogs not fitting on the screen |
206 | of the Z 5500. | 211 | of the Z 5500. |
207 | 212 | ||
208 | Fixed Qtopia crash, when disabling/deinstalling | 213 | Fixed Qtopia crash, when disabling/deinstalling |
209 | KO/Pi alarm applet. | 214 | KO/Pi alarm applet. |
210 | 215 | ||
211 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 216 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
212 | on Linux desktop. | 217 | on Linux desktop. |
213 | 218 | ||
214 | Added feature "remove sync info" to sync menu. | 219 | Added feature "remove sync info" to sync menu. |
215 | 220 | ||
216 | Tweaked the KO/Pi What's next view a bit, added | 221 | Tweaked the KO/Pi What's next view a bit, added |
217 | setting to hide events that are done. | 222 | setting to hide events that are done. |
218 | 223 | ||
219 | Disabled "beam receive enabled" on startup to | 224 | Disabled "beam receive enabled" on startup to |
220 | avoid problems if Fastload is enabled. | 225 | avoid problems if Fastload is enabled. |
221 | Please set "beam receive enabled", | 226 | Please set "beam receive enabled", |
222 | if you want to receive data via IR. | 227 | if you want to receive data via IR. |
223 | 228 | ||
224 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 229 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
225 | on Linux desktop. | 230 | on Linux desktop. |
226 | 231 | ||
227 | Made in KA/Pi scrolling possible, if details view is selected. | 232 | Made in KA/Pi scrolling possible, if details view is selected. |
228 | (The keyboard focus is set automatically to the search line) | 233 | (The keyboard focus is set automatically to the search line) |
229 | 234 | ||
230 | Fixed a bug in DMT sync, that a new entry in DTM was added | 235 | Fixed a bug in DMT sync, that a new entry in DTM was added |
231 | on every sync to Kx/Pi. | 236 | on every sync to Kx/Pi. |
232 | 237 | ||
233 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 238 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
234 | 239 | ||
235 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 240 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
236 | non-latin1 characters. | 241 | non-latin1 characters. |
237 | 242 | ||
238 | Rearranged package contents of Sharp-ipks and made all | 243 | Rearranged package contents of Sharp-ipks and made all |
239 | packages installable on SD again. | 244 | packages installable on SD again. |
240 | 245 | ||
241 | Fixed the writing of addressbook data in DTM sync. | 246 | Fixed the writing of addressbook data in DTM sync. |
242 | Empty fields in KA/Pi were not removed. | 247 | Empty fields in KA/Pi were not removed. |
243 | 248 | ||
244 | Added better category handling in KA/Pi: | 249 | Added better category handling in KA/Pi: |
245 | Added item | 250 | Added item |
246 | Edit Categories and | 251 | Edit Categories and |
247 | Manage new categories | 252 | Manage new categories |
248 | to the settings menu. | 253 | to the settings menu. |
249 | Possible to configure a view to display categories. | 254 | Possible to configure a view to display categories. |
250 | 255 | ||
251 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 256 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
252 | 257 | ||
253 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 258 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
254 | 259 | ||
255 | ... and many other bugfixes. | 260 | ... and many other bugfixes. |
256 | 261 | ||
257 | ********** VERSION 1.9.10 ************ | 262 | ********** VERSION 1.9.10 ************ |
258 | 263 | ||
259 | Many internal small bugfixes. | 264 | Many internal small bugfixes. |
260 | And fix of the "big" bug in KO/Pi, | 265 | And fix of the "big" bug in KO/Pi, |
261 | that after Syncing the appointments had an offset by several hours. | 266 | that after Syncing the appointments had an offset by several hours. |
262 | That was a problem with the internal timezone setting, | 267 | That was a problem with the internal timezone setting, |
263 | introduced by the changed timezone configuration settings. | 268 | introduced by the changed timezone configuration settings. |
264 | 269 | ||
265 | German translation for OM/Pi is now available. | 270 | German translation for OM/Pi is now available. |
266 | 271 | ||
267 | 272 | ||
268 | ********** VERSION 1.9.9 ************ | 273 | ********** VERSION 1.9.9 ************ |
269 | 274 | ||
270 | KDE-Pim/Pi has a new Member! | 275 | KDE-Pim/Pi has a new Member! |
271 | It is called PWM/Pi (Passwordmanager/platform-independent) | 276 | It is called PWM/Pi (Passwordmanager/platform-independent) |
272 | and it is available for the Zaurus. | 277 | and it is available for the Zaurus. |
273 | It is planned, that it will be available later for Windows. | 278 | It is planned, that it will be available later for Windows. |
274 | (And for Linux, of course). | 279 | (And for Linux, of course). |
275 | It is a port of the Passwordmanager of KDE. | 280 | It is a port of the Passwordmanager of KDE. |
276 | It will need the MicroKDElibs to run. | 281 | It will need the MicroKDElibs to run. |
277 | 282 | ||
278 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 283 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
279 | The bigger your addressbook file, the more starting speed | 284 | The bigger your addressbook file, the more starting speed |
280 | will you gain. (relatively) | 285 | will you gain. (relatively) |
281 | 286 | ||
282 | The Qtopia addressbook connector is now platform independend | 287 | The Qtopia addressbook connector is now platform independend |
283 | as well and should work on any platform for importing/exporting | 288 | as well and should work on any platform for importing/exporting |
284 | Qtopia and Opie XML files. | 289 | Qtopia and Opie XML files. |
285 | 290 | ||
286 | Added a +30min feature to the timezone settings to make | 291 | Added a +30min feature to the timezone settings to make |
287 | KDE-Pim/Pi useable in Australia and other parts on the | 292 | KDE-Pim/Pi useable in Australia and other parts on the |
288 | world with strange timezones ;-) | 293 | world with strange timezones ;-) |
289 | 294 | ||
290 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 295 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
291 | 296 | ||
292 | It is now possible to disable the | 297 | It is now possible to disable the |
293 | "receive data via infrared" feature, such that syncing with | 298 | "receive data via infrared" feature, such that syncing with |
294 | Outlook is now possible again with Kx/Pi runing. | 299 | Outlook is now possible again with Kx/Pi runing. |
295 | Please disable it, before syncing Sharp DTM with Outlook. | 300 | Please disable it, before syncing Sharp DTM with Outlook. |
296 | For your convenience, the "receive data via infrared" feature | 301 | For your convenience, the "receive data via infrared" feature |
297 | is disabled automatically, if you sync Kx/Pi with DTM. | 302 | is disabled automatically, if you sync Kx/Pi with DTM. |
298 | You have to enable it again manually after syncing. | 303 | You have to enable it again manually after syncing. |
299 | Enabling this feature makes it impossible to start the | 304 | Enabling this feature makes it impossible to start the |
300 | Sharp DTM apps. If this feature is enabled, you will only get the | 305 | Sharp DTM apps. If this feature is enabled, you will only get the |
301 | alarm notification from KO/Pi and not from the Sharp calendar. | 306 | alarm notification from KO/Pi and not from the Sharp calendar. |
302 | This is very useful if you sync KO/Pi with Sharp DTM, | 307 | This is very useful if you sync KO/Pi with Sharp DTM, |
303 | because after syncing you usually would get notified about | 308 | because after syncing you usually would get notified about |
304 | an alarm by KO/Pi and the Sharp Calendar. | 309 | an alarm by KO/Pi and the Sharp Calendar. |
305 | 310 | ||
306 | Together with the Linux desktop version of KO/Pi | 311 | Together with the Linux desktop version of KO/Pi |
307 | it is now possible to sync KO/Pi on the Zaurus | 312 | it is now possible to sync KO/Pi on the Zaurus |
308 | with the complete KDE-desktop (3.3 or later) | 313 | with the complete KDE-desktop (3.3 or later) |
309 | calendar data easily. | 314 | calendar data easily. |
310 | That makes it possible to sync the Z with one | 315 | That makes it possible to sync the Z with one |
311 | click of a mouse with the KDE-Desktop. | 316 | click of a mouse with the KDE-Desktop. |
312 | This feature it available for all Zaurus platforms KO/Pi | 317 | This feature it available for all Zaurus platforms KO/Pi |
313 | is running on. | 318 | is running on. |
314 | The only thing needed is a running KO/Pi on Linux and | 319 | The only thing needed is a running KO/Pi on Linux and |
315 | a compiled version of the small | 320 | a compiled version of the small |
316 | KDE-Pim/Pi<->KDE-Desktop access command line program, | 321 | KDE-Pim/Pi<->KDE-Desktop access command line program, |
317 | which is in the KDE-Pim/Pi sources available. | 322 | which is in the KDE-Pim/Pi sources available. |
318 | 323 | ||
319 | The "KDE-desktop" syncing feature for KA/Pi will follow | 324 | The "KDE-desktop" syncing feature for KA/Pi will follow |
320 | in the next releases. | 325 | in the next releases. |
321 | 326 | ||
322 | Fixed the vcard export bug, which had the version 1.9.8. | 327 | Fixed the vcard export bug, which had the version 1.9.8. |
323 | 328 | ||
324 | Added missing GERMAN translation to KO/Pi. | 329 | Added missing GERMAN translation to KO/Pi. |
325 | Hi PsionX, could you add the missing french translation?Thx! | 330 | Hi PsionX, could you add the missing french translation?Thx! |
326 | 331 | ||
327 | Translation files for KA/Pi are available as well. | 332 | Translation files for KA/Pi are available as well. |
328 | GERMAN translation will be available in the next release. | 333 | GERMAN translation will be available in the next release. |
329 | PsionX ( yres, you again ;-) ), could you start translating | 334 | PsionX ( yres, you again ;-) ), could you start translating |
330 | KA/Pi? Thx! | 335 | KA/Pi? Thx! |
331 | 336 | ||
332 | You can download the version 1.9.9 at | 337 | You can download the version 1.9.9 at |
333 | 338 | ||
334 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 | 339 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 |
335 | 340 | ||
336 | Note: | 341 | Note: |
337 | To run the mail program OM/Pi you need libopenssl. | 342 | To run the mail program OM/Pi you need libopenssl. |
338 | A link to a download loaction is available at | 343 | A link to a download loaction is available at |
339 | ZSI at www.killefiz.de | 344 | ZSI at www.killefiz.de |
340 | 345 | ||
341 | 346 | ||
342 | ********** VERSION 1.9.8 ************ | 347 | ********** VERSION 1.9.8 ************ |
343 | 348 | ||
344 | Fixed character decoding in OM/Pi. | 349 | Fixed character decoding in OM/Pi. |
345 | (e.g. German "Umlaute" were not displayed properly.) | 350 | (e.g. German "Umlaute" were not displayed properly.) |
346 | 351 | ||
347 | Made is possible to reparent todos in KO/Pi. | 352 | Made is possible to reparent todos in KO/Pi. |
348 | Use contextmenu or keys (look at Help-Keys + Colors) for that. | 353 | Use contextmenu or keys (look at Help-Keys + Colors) for that. |
349 | 354 | ||
350 | Added the missing Sync-Howto and WhatsNew to the packages. | 355 | Added the missing Sync-Howto and WhatsNew to the packages. |
351 | 356 | ||
352 | KO/Pi on Linux desktop can now sync with KDE desktop. | 357 | KO/Pi on Linux desktop can now sync with KDE desktop. |
353 | That means: When using KO/Pi on Linux desktop for syncing with | 358 | That means: When using KO/Pi on Linux desktop for syncing with |
354 | KDE desktop and the Zaurus, the Zaurus can be synced now | 359 | KDE desktop and the Zaurus, the Zaurus can be synced now |
355 | with all KDE-Calendar resources, not only with one local file. | 360 | with all KDE-Calendar resources, not only with one local file. |
356 | (That makes it possible to sync the Zaurus with the | 361 | (That makes it possible to sync the Zaurus with the |
357 | calendar data on a Kolab server) | 362 | calendar data on a Kolab server) |
358 | 363 | ||
359 | KA/Pi syncing with KDE desktop will be available in the next version. | 364 | KA/Pi syncing with KDE desktop will be available in the next version. |
360 | 365 | ||
361 | 366 | ||
362 | ********** VERSION 1.9.7 ************ | 367 | ********** VERSION 1.9.7 ************ |
363 | 368 | ||
364 | KO/Pi - KA/Pi on Windows: | 369 | KO/Pi - KA/Pi on Windows: |
365 | Now a directory can be defined by the user, where the | 370 | Now a directory can be defined by the user, where the |
366 | application/config data should be saved. | 371 | application/config data should be saved. |
367 | Define your desired path in the evironment variable | 372 | Define your desired path in the evironment variable |
368 | MICROKDEHOME | 373 | MICROKDEHOME |
369 | before starting KO/Pi or KA/Pi. | 374 | before starting KO/Pi or KA/Pi. |
370 | 375 | ||
371 | An easy Kx/Pi to Kx/Pi syncing is now possible | 376 | An easy Kx/Pi to Kx/Pi syncing is now possible |
372 | (it is called Pi-Sync) via network. | 377 | (it is called Pi-Sync) via network. |
373 | Please look at the Sync Howto. | 378 | Please look at the Sync Howto. |
374 | 379 | ||
375 | Exporting of calendar data and contacts to mobile phones is now possible. | 380 | Exporting of calendar data and contacts to mobile phones is now possible. |
376 | The SyncHowto is updated with information howto | 381 | The SyncHowto is updated with information howto |
377 | access/sync mobile phones. | 382 | access/sync mobile phones. |
378 | Please look at the Sync Howto. | 383 | Please look at the Sync Howto. |
379 | 384 | ||
380 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. | 385 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. |
381 | Please disable Fastload for the original contact/calendar applications | 386 | Please disable Fastload for the original contact/calendar applications |
382 | and close them. | 387 | and close them. |
383 | KO/Pi and KA/Pi must be running in order to receive the data. | 388 | KO/Pi and KA/Pi must be running in order to receive the data. |
384 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) | 389 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) |
385 | 390 | ||
386 | In the KA/Pi details view are now the preferred tel. numbers displayed on top | 391 | In the KA/Pi details view are now the preferred tel. numbers displayed on top |
387 | of the other data ( emails/tel.numbers/addresses) | 392 | of the other data ( emails/tel.numbers/addresses) |
388 | 393 | ||
389 | Fixed some syncing problems in KA/Pi. | 394 | Fixed some syncing problems in KA/Pi. |
390 | 395 | ||
391 | Added font settings for the KA/Pi details view. | 396 | Added font settings for the KA/Pi details view. |
392 | Added fields "children's name" and "gender" to KA/Pi. | 397 | Added fields "children's name" and "gender" to KA/Pi. |
393 | 398 | ||
394 | Made searching in KA/Pi better: | 399 | Made searching in KA/Pi better: |
395 | Now the first item in a view is selected after a search automatically and | 400 | Now the first item in a view is selected after a search automatically and |
396 | the views can be scrolled up/down when the search input field has the keyboard focus. | 401 | the views can be scrolled up/down when the search input field has the keyboard focus. |
397 | 402 | ||
398 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. | 403 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. |
399 | 404 | ||
400 | 405 | ||
401 | ********** VERSION 1.9.6 ************ | 406 | ********** VERSION 1.9.6 ************ |
402 | 407 | ||
403 | Changes in the external application communication on the Zaurus | 408 | Changes in the external application communication on the Zaurus |
404 | in order to use less RAM when the apps are running. | 409 | in order to use less RAM when the apps are running. |
405 | First syncing of addressbooks (KA/Pi) is possible. | 410 | First syncing of addressbooks (KA/Pi) is possible. |
406 | 411 | ||
407 | 412 | ||
408 | ********** VERSION 1.9.5a ************ | 413 | ********** VERSION 1.9.5a ************ |
409 | 414 | ||
410 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. | 415 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. |
411 | Fixed some small bugs. | 416 | Fixed some small bugs. |
412 | KA/Pi shows now the birthday in summary view. | 417 | KA/Pi shows now the birthday in summary view. |
413 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi | 418 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi |
414 | for displaying dates. | 419 | for displaying dates. |
415 | 420 | ||
416 | 421 | ||
417 | ********** VERSION 1.9.5 ************ | 422 | ********** VERSION 1.9.5 ************ |
418 | 423 | ||
419 | There is still no Addressbook syncing! | 424 | There is still no Addressbook syncing! |
420 | 425 | ||
421 | New in 1.9.5: | 426 | New in 1.9.5: |
422 | 427 | ||
423 | Many bugfixes. | 428 | Many bugfixes. |
424 | Better searching in KA/Pi. | 429 | Better searching in KA/Pi. |
425 | You can configure in KA/Pi if you want to search only after | 430 | You can configure in KA/Pi if you want to search only after |
426 | <return> key pressed. | 431 | <return> key pressed. |
427 | 432 | ||
428 | Better mail downloading in OM/Pi. | 433 | Better mail downloading in OM/Pi. |
429 | 434 | ||
430 | First experimental alpha version of sync of KO/Pi with mobile phones. | 435 | First experimental alpha version of sync of KO/Pi with mobile phones. |
431 | See gammu documentation for supported phones. | 436 | See gammu documentation for supported phones. |
432 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. | 437 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. |
433 | Quick hint how to use: | 438 | Quick hint how to use: |
434 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! | 439 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! |
435 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. | 440 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. |
436 | Create syncprofile - mobile device | 441 | Create syncprofile - mobile device |
437 | Remove entry for model. (Leave empty ). | 442 | Remove entry for model. (Leave empty ). |
438 | Enable infrared on Zaurus and your Phone. | 443 | Enable infrared on Zaurus and your Phone. |
439 | Sync. | 444 | Sync. |
440 | To get a more detailed log, start kopi from konsole. | 445 | To get a more detailed log, start kopi from konsole. |
441 | 446 | ||
442 | ********** VERSION 1.9.4 ************ | 447 | ********** VERSION 1.9.4 ************ |
443 | 448 | ||
444 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | 449 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. |
445 | 450 | ||
446 | WARNING: | 451 | WARNING: |
447 | PLEASE BACKUP ALL YOUR DATA! | 452 | PLEASE BACKUP ALL YOUR DATA! |
448 | We have changed a lot and maybe there are some unknown problems. | 453 | We have changed a lot and maybe there are some unknown problems. |
449 | 454 | ||
450 | SYNC HANDLING HAS CHANGED! | 455 | SYNC HANDLING HAS CHANGED! |
451 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 456 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
452 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 457 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
453 | 458 | ||
454 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | 459 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. |
455 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. | 460 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. |
456 | 461 | ||
457 | As programs are available: | 462 | As programs are available: |
458 | KO/Pi (korganizer ipk) - a calendar program. | 463 | KO/Pi (korganizer ipk) - a calendar program. |
459 | KA/Pi (kaddressbook ipk ) - an addressbook | 464 | KA/Pi (kaddressbook ipk ) - an addressbook |
460 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | 465 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. |
461 | 466 | ||
462 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | 467 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. |
463 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | 468 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) |
464 | 469 | ||
465 | All the applications are installed in a "Pim" TAB. | 470 | All the applications are installed in a "Pim" TAB. |
466 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk | 471 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk |
467 | 472 | ||
468 | All the application are integrated. | 473 | All the application are integrated. |
469 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. | 474 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. |
470 | 475 | ||
471 | HINT: | 476 | HINT: |
472 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | 477 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. |
473 | 478 | ||
474 | What's new? | 479 | What's new? |
475 | 480 | ||
476 | SYNC HANDLING HAS CHANGED! | 481 | SYNC HANDLING HAS CHANGED! |
477 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 482 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
478 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 483 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
479 | 484 | ||
480 | New in OM/Pi: | 485 | New in OM/Pi: |
481 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. | 486 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. |
482 | 487 | ||
483 | New in KO/Pi: | 488 | New in KO/Pi: |
484 | French is now available for KO/Pi. | 489 | French is now available for KO/Pi. |
485 | Choose menu:Actions - Configure:TAB locale | 490 | Choose menu:Actions - Configure:TAB locale |
486 | Syncing has changed. | 491 | Syncing has changed. |
487 | Phone sync available soon. | 492 | Phone sync available soon. |
488 | Not much changes, I cannot remember them ... | 493 | Not much changes, I cannot remember them ... |
489 | 494 | ||
490 | New in KA/Pi: | 495 | New in KA/Pi: |
491 | Beaming possible. | 496 | Beaming possible. |
492 | Sharp DTM readonly access possible( create a new DTM resource ); | 497 | Sharp DTM readonly access possible( create a new DTM resource ); |
493 | Better searching possible. | 498 | Better searching possible. |
494 | Search is performed only after pressing the return key. | 499 | Search is performed only after pressing the return key. |
495 | Use wildcard * to specify parts of a name. | 500 | Use wildcard * to specify parts of a name. |
496 | 501 | ||
497 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . | 502 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . |
498 | 503 | ||
499 | A big improvement is the new management of the contact access. | 504 | A big improvement is the new management of the contact access. |
500 | In version 1.9.3, every application was using their own addressbook access data. | 505 | In version 1.9.3, every application was using their own addressbook access data. |
501 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | 506 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. |
502 | That was wasting of memory, if you had several hundreds of contacts. | 507 | That was wasting of memory, if you had several hundreds of contacts. |
503 | 508 | ||
504 | Now only KA/Pi accesses the addressbook. | 509 | Now only KA/Pi accesses the addressbook. |
505 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. | 510 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. |
506 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | 511 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. |
507 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | 512 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. |
508 | 513 | ||
509 | New in the KO/Pi alarm applet: | 514 | New in the KO/Pi alarm applet: |
510 | Configure your own timer popup menu! | 515 | Configure your own timer popup menu! |
511 | (Text and minutes for timer countdown) | 516 | (Text and minutes for timer countdown) |
512 | Just edit the file | 517 | Just edit the file |
513 | (yourhomedir)/.kopialarmtimerrc | 518 | (yourhomedir)/.kopialarmtimerrc |
514 | and start/stop a timer to get a new menu with the data of this file. | 519 | and start/stop a timer to get a new menu with the data of this file. |
515 | 520 | ||
516 | ********** VERSION 1.9.3 ************ | 521 | ********** VERSION 1.9.3 ************ |
517 | 1) | 522 | 1) |
518 | Now KO/Pi on Windows imports directly the calendar data of | 523 | Now KO/Pi on Windows imports directly the calendar data of |
519 | an installed Outlook. Should work with OL version >= 2000. | 524 | an installed Outlook. Should work with OL version >= 2000. |
520 | 525 | ||
521 | ********** VERSION 1.9.2 ************ | 526 | ********** VERSION 1.9.2 ************ |
522 | 1) | 527 | 1) |
523 | KDE-Pim/Pi has got a new member: | 528 | KDE-Pim/Pi has got a new member: |
524 | KmicroMail (KM/Pi) is a mail program, | 529 | KmicroMail (KM/Pi) is a mail program, |
525 | which can handle IMAP and POP mail access. | 530 | which can handle IMAP and POP mail access. |
526 | It is based on Opie-Mail v3. | 531 | It is based on Opie-Mail v3. |
527 | All dependencies to the Opie libraries ar removed, | 532 | All dependencies to the Opie libraries ar removed, |
528 | such that no additional Opie lib is needed. | 533 | such that no additional Opie lib is needed. |
529 | It is already integrated in KO/Pi and KA/Pi. | 534 | It is already integrated in KO/Pi and KA/Pi. |
530 | It it now available for the Zaurus,probably it | 535 | It it now available for the Zaurus,probably it |
531 | will be available for other platforms later. | 536 | will be available for other platforms later. |
532 | Hint: | 537 | Hint: |
533 | Create your own contact (name + email) | 538 | Create your own contact (name + email) |
534 | in KA/Pi, select this contact and choose menu: | 539 | in KA/Pi, select this contact and choose menu: |
535 | Settings - Set Who Am I. | 540 | Settings - Set Who Am I. |
536 | Now the settings of this contact are used as | 541 | Now the settings of this contact are used as |
537 | the sender data in KM/Pi. | 542 | the sender data in KM/Pi. |
538 | 2) | 543 | 2) |
539 | KDE-Pim/Pi is split up in five different | 544 | KDE-Pim/Pi is split up in five different |
540 | packages now precompiled for Sharp Zaurus: | 545 | packages now precompiled for Sharp Zaurus: |
541 | --kmicrokdelibs_1.9.2_arm.ipk | 546 | --kmicrokdelibs_1.9.2_arm.ipk |
542 | The libs are needed for any | 547 | The libs are needed for any |
543 | of the following programs: | 548 | of the following programs: |
544 | --kaddressbook_1.9.2_arm.ipk | 549 | --kaddressbook_1.9.2_arm.ipk |
545 | --kmicromail_1.9.2_arm.ipk | 550 | --kmicromail_1.9.2_arm.ipk |
546 | --korganizer_1.9.2_arm.ipk | 551 | --korganizer_1.9.2_arm.ipk |
547 | Independ from that, there is the alarm applet | 552 | Independ from that, there is the alarm applet |
548 | available for KO/Pi, which also offers | 553 | available for KO/Pi, which also offers |
549 | quick access for a new mail or | 554 | quick access for a new mail or |
550 | showing the addressbook.: | 555 | showing the addressbook.: |
551 | --korganizer-alarm_1.9.2_arm.ipk | 556 | --korganizer-alarm_1.9.2_arm.ipk |
552 | Independend means, that the alarm applet | 557 | Independend means, that the alarm applet |
553 | does not need any of the libs or programs above to run. | 558 | does not need any of the libs or programs above to run. |
554 | But it would be quite useless without these programs. | 559 | But it would be quite useless without these programs. |
555 | NOTE: | 560 | NOTE: |
556 | If you get a | 561 | If you get a |
557 | "This application depends on other programs" | 562 | "This application depends on other programs" |
558 | during installation of | 563 | during installation of |
559 | --kmicrokdelibs_1.9.2_arm.ipk | 564 | --kmicrokdelibs_1.9.2_arm.ipk |
560 | you probably do not have to care about that. | 565 | you probably do not have to care about that. |
561 | kmicrokdelibs_1.9.2 will come with some | 566 | kmicrokdelibs_1.9.2 will come with some |
562 | resource plugins, which needs additional libraries. | 567 | resource plugins, which needs additional libraries. |
563 | (E.g. libopie1, if you want to use the | 568 | (E.g. libopie1, if you want to use the |
564 | opie resource connector in KA/Pi). | 569 | opie resource connector in KA/Pi). |
565 | If you do not have this libraries installed, | 570 | If you do not have this libraries installed, |
566 | you simply cannot use the resource. | 571 | you simply cannot use the resource. |
567 | To make it clear: | 572 | To make it clear: |
568 | If the libraries are missing, the applications | 573 | If the libraries are missing, the applications |
569 | using kmicrokdelibs will start, | 574 | using kmicrokdelibs will start, |
570 | because the resources are plugins. | 575 | because the resources are plugins. |
571 | 3) | 576 | 3) |
572 | KO/Pi and friends are now installable on SD-Card! | 577 | KO/Pi and friends are now installable on SD-Card! |
573 | It is recommended to install all libs and apps | 578 | It is recommended to install all libs and apps |
574 | on the SD card or all in the internal storage. | 579 | on the SD card or all in the internal storage. |
575 | There may be problems, if this is mixed. | 580 | There may be problems, if this is mixed. |
576 | 4) | 581 | 4) |
577 | Fixed two bugs in the alarm notification on Windows. | 582 | Fixed two bugs in the alarm notification on Windows. |
578 | 5) | 583 | 5) |
579 | Great improvement! | 584 | Great improvement! |
580 | KO/Pi uses now the latest version of libical. | 585 | KO/Pi uses now the latest version of libical. |
581 | Libical is the library which actually reads | 586 | Libical is the library which actually reads |
582 | the calendar files and extract the data from it. | 587 | the calendar files and extract the data from it. |
583 | With the old version, there were problems | 588 | With the old version, there were problems |
584 | (crashes or program hangs) when licical did read | 589 | (crashes or program hangs) when licical did read |
585 | files, which were not stored from KO/Pi. | 590 | files, which were not stored from KO/Pi. |
586 | I do not know, if the new libical works perfect, | 591 | I do not know, if the new libical works perfect, |
587 | but actually it works much better than | 592 | but actually it works much better than |
588 | the old version. | 593 | the old version. |
589 | There are no problems with compatibility with | 594 | There are no problems with compatibility with |
590 | old calendar files of KO/Pi, of course! | 595 | old calendar files of KO/Pi, of course! |
591 | 6) | 596 | 6) |
592 | New in KA/Pi: | 597 | New in KA/Pi: |
593 | Opie addressbook resource connector available! | 598 | Opie addressbook resource connector available! |
594 | You will need libopie1 and the opie addressbook, | 599 | You will need libopie1 and the opie addressbook, |
595 | of course. | 600 | of course. |
596 | With the Opie addressbook resource connector, | 601 | With the Opie addressbook resource connector, |
597 | you can access the Opie addressbook readonly in KA/Pi. | 602 | you can access the Opie addressbook readonly in KA/Pi. |
598 | If you want to edit or import the data into KA/Pi, | 603 | If you want to edit or import the data into KA/Pi, |
599 | do this: | 604 | do this: |
600 | a) Create an Opie resource. | 605 | a) Create an Opie resource. |
601 | (Menu: Settings-Configure Resources). | 606 | (Menu: Settings-Configure Resources). |
602 | After configuration and restarting KA/Pi you should see | 607 | After configuration and restarting KA/Pi you should see |
603 | the Opie contacts in KA/Pi. | 608 | the Opie contacts in KA/Pi. |
604 | b) Select some or all Opie contacts. | 609 | b) Select some or all Opie contacts. |
605 | (NOTE: +++++ | 610 | (NOTE: +++++ |
606 | To know exactly, what contacts are Opie contacts, | 611 | To know exactly, what contacts are Opie contacts, |
607 | do this: Choose menu: | 612 | do this: Choose menu: |
608 | View-Modify View - TAB Fields. | 613 | View-Modify View - TAB Fields. |
609 | Select in the above list "Resource" and click | 614 | Select in the above list "Resource" and click |
610 | down arrow to add it to the "Selected fields". | 615 | down arrow to add it to the "Selected fields". |
611 | Click OK. | 616 | Click OK. |
612 | Now you have a new column "Resource" in your list, | 617 | Now you have a new column "Resource" in your list, |
613 | where you can see, what an Opie resource is. | 618 | where you can see, what an Opie resource is. |
614 | ++++ NOTE end.) | 619 | ++++ NOTE end.) |
615 | Ok, we do have now some Opie contacts seleted. | 620 | Ok, we do have now some Opie contacts seleted. |
616 | (Use SHIFT or CTRL key in order to multiple select). | 621 | (Use SHIFT or CTRL key in order to multiple select). |
617 | c) Choose menu: Edit-Copy. | 622 | c) Choose menu: Edit-Copy. |
618 | d) Choose menu: Edit-Paste. | 623 | d) Choose menu: Edit-Paste. |
619 | e) Select the resource, you want to add the contacts to. | 624 | e) Select the resource, you want to add the contacts to. |
620 | Congrats! Now you have read/write access to the copied | 625 | Congrats! Now you have read/write access to the copied |
621 | opie contacts as "real" KA/Pi contacts. | 626 | opie contacts as "real" KA/Pi contacts. |
622 | 627 | ||
623 | 628 | ||
624 | ********** VERSION 1.9.1 ************ | 629 | ********** VERSION 1.9.1 ************ |
625 | 1) | 630 | 1) |
626 | +++ IMPORTANT 1 +++ | 631 | +++ IMPORTANT 1 +++ |
627 | 632 | ||
628 | The storing place of the default calendar | 633 | The storing place of the default calendar |
629 | file has changed! | 634 | file has changed! |
630 | The default calendar file was | 635 | The default calendar file was |
631 | Applications/korganizer/mycalendar.ics | 636 | Applications/korganizer/mycalendar.ics |
632 | on Zaurus and | 637 | on Zaurus and |
633 | (yourHomeDir)/korganizer/mycalendar.ics | 638 | (yourHomeDir)/korganizer/mycalendar.ics |
634 | on Windows/Linux desktop. Now it is | 639 | on Windows/Linux desktop. Now it is |
635 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics | 640 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics |
636 | on Zaurus, Windows and Linux. | 641 | on Zaurus, Windows and Linux. |
637 | To load the old file, choose menu | 642 | To load the old file, choose menu |
638 | File-Load calendar backup. | 643 | File-Load calendar backup. |
639 | (It should be loaded automatically | 644 | (It should be loaded automatically |
640 | at startup with a warning message displayed). | 645 | at startup with a warning message displayed). |
641 | The place of the configuration file has changed too. | 646 | The place of the configuration file has changed too. |
642 | If you want to use your old KO/Pi config, | 647 | If you want to use your old KO/Pi config, |
643 | copy it to | 648 | copy it to |
644 | (yourHomeDir)/kdepim/config/korganizerrc | 649 | (yourHomeDir)/kdepim/config/korganizerrc |
645 | Please read VERSION 1.9.0 - topic 3) as well! | 650 | Please read VERSION 1.9.0 - topic 3) as well! |
646 | 651 | ||
647 | +++ IMPORTANT 2 +++ | 652 | +++ IMPORTANT 2 +++ |
648 | 653 | ||
649 | Because of the new paths, you will need | 654 | Because of the new paths, you will need |
650 | a new version of the KO/Pi alarm applet | 655 | a new version of the KO/Pi alarm applet |
651 | for Zaurus. | 656 | for Zaurus. |
652 | Use version >= 1.9.1 | 657 | Use version >= 1.9.1 |
653 | 658 | ||
654 | 2) | 659 | 2) |
655 | Now the QWhat'sThis Icon works for items | 660 | Now the QWhat'sThis Icon works for items |
656 | in the month view as well. | 661 | in the month view as well. |
657 | (See VERSION 1.7.8 Topic 1) ). | 662 | (See VERSION 1.7.8 Topic 1) ). |
658 | 3) | 663 | 3) |
659 | You can import birtsdays/anniversaries | 664 | You can import birtsdays/anniversaries |
660 | from KA/Pi into KO/Pi. | 665 | from KA/Pi into KO/Pi. |
661 | Choose menu File-Import birthdays. | 666 | Choose menu File-Import birthdays. |
662 | If you import twice, already imported items | 667 | If you import twice, already imported items |
663 | will not be imported again, if they | 668 | will not be imported again, if they |
664 | have not been changed in KO/Pi. | 669 | have not been changed in KO/Pi. |
665 | 4) | 670 | 4) |
666 | When syncing with sharp DTM, now a progress | 671 | When syncing with sharp DTM, now a progress |
667 | is shown, when the data is written back. | 672 | is shown, when the data is written back. |
668 | If there is much data in KO/Pi and no data | 673 | If there is much data in KO/Pi and no data |
669 | in DTM, that can take a long time. | 674 | in DTM, that can take a long time. |
670 | (But only for the first time ). | 675 | (But only for the first time ). |
671 | 5) | 676 | 5) |
672 | In the search dialog, you can search | 677 | In the search dialog, you can search |
673 | now for the name/email of an attendee | 678 | now for the name/email of an attendee |
674 | of an event/todo. | 679 | of an event/todo. |
675 | To get more space for displaying | 680 | To get more space for displaying |
676 | search results, the buttons | 681 | search results, the buttons |
677 | for "search" and "close" on the | 682 | for "search" and "close" on the |
678 | bottom are removed in the PDA version. | 683 | bottom are removed in the PDA version. |
679 | You have to click OK in the top right | 684 | You have to click OK in the top right |
680 | corner to do a search. | 685 | corner to do a search. |
681 | 6) | 686 | 6) |
682 | Now it is possible to disable the displaying | 687 | Now it is possible to disable the displaying |
683 | of todo items in the Allday part of the Agenda. | 688 | of todo items in the Allday part of the Agenda. |
684 | Choose Menu Action-Configure, | 689 | Choose Menu Action-Configure, |
685 | TAB Todo View, checkbox | 690 | TAB Todo View, checkbox |
686 | "Allday Agenda view shows todos" | 691 | "Allday Agenda view shows todos" |
687 | 7) | 692 | 7) |
688 | If FastLoad is enabled, now the settings and the | 693 | If FastLoad is enabled, now the settings and the |
689 | calendar data are saved, when KO/Pi is closed. | 694 | calendar data are saved, when KO/Pi is closed. |
690 | (If no Fastload is enabled, KO/Pi saves | 695 | (If no Fastload is enabled, KO/Pi saves |
691 | the data as well, of course) | 696 | the data as well, of course) |
692 | 8) | 697 | 8) |
693 | The Agenda View has a minimize-splitter now, | 698 | The Agenda View has a minimize-splitter now, |
694 | such that the height of the allday part can be | 699 | such that the height of the allday part can be |
695 | changed quickly. | 700 | changed quickly. |
696 | 701 | ||
697 | ********** VERSION 1.9.0 ************ | 702 | ********** VERSION 1.9.0 ************ |
698 | 1) | 703 | 1) |
699 | KO/Pi is now merged with the new microKDE from KA/Pi. | 704 | KO/Pi is now merged with the new microKDE from KA/Pi. |
700 | KO/Pi accesses now KA/Pi as the addressbook. | 705 | KO/Pi accesses now KA/Pi as the addressbook. |
701 | The other ddressbook-plugins are not working any longer. | 706 | The other ddressbook-plugins are not working any longer. |
702 | (It is planned, that later KA/Pi itself uses these plugins) | 707 | (It is planned, that later KA/Pi itself uses these plugins) |
703 | New versions of KO/Pi are only available | 708 | New versions of KO/Pi are only available |
704 | together with KA/Pi as the KDE-Pim/Pi package. | 709 | together with KA/Pi as the KDE-Pim/Pi package. |
705 | 2) | 710 | 2) |
706 | If you click on an attendee of a meeting in the | 711 | If you click on an attendee of a meeting in the |
707 | event viewer, a detailed summary of the | 712 | event viewer, a detailed summary of the |
708 | attendee is shown. | 713 | attendee is shown. |
709 | 3) | 714 | 3) |
710 | The place of the configuration file has changed. | 715 | The place of the configuration file has changed. |
711 | If you want to use your old KO/Pi config, copy | 716 | If you want to use your old KO/Pi config, copy |
712 | Applications/korganizer/config_korganizerrc | 717 | Applications/korganizer/config_korganizerrc |
713 | to | 718 | to |
714 | Applications/korganizer/config/korganizerrc | 719 | Applications/korganizer/config/korganizerrc |
715 | 720 | ||
716 | ********** VERSION 1.7.8 ************ | 721 | ********** VERSION 1.7.8 ************ |
717 | 1) | 722 | 1) |
718 | Now the QWhat'sThis ist working. | 723 | Now the QWhat'sThis ist working. |
719 | Enable the QWhat'sThis icon in the toolbar. | 724 | Enable the QWhat'sThis icon in the toolbar. |
720 | (You have to restart to reload the changed toolbar config). | 725 | (You have to restart to reload the changed toolbar config). |
721 | Now click on the QWhat'sThis Icon | 726 | Now click on the QWhat'sThis Icon |
722 | in the top right corner of KO/Pi. | 727 | in the top right corner of KO/Pi. |
723 | Then click on an item in the Agenda View: | 728 | Then click on an item in the Agenda View: |
724 | You will get a detailed display of the items content. | 729 | You will get a detailed display of the items content. |
725 | 2) | 730 | 2) |
726 | Some other very minor changes. | 731 | Some other very minor changes. |
727 | But I have forgotten the details ... | 732 | But I have forgotten the details ... |
728 | For that reason I start this log here: | 733 | For that reason I start this log here: |
729 | To document my changes, when I am doing it. | 734 | To document my changes, when I am doing it. |
730 | 735 | ||
731 | ********** VERSION 1.7.7 ************ | 736 | ********** VERSION 1.7.7 ************ |
732 | Stable Version of KO/Pi | 737 | Stable Version of KO/Pi |
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index fc5be71..30b792b 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp | |||
@@ -1,444 +1,427 @@ | |||
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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qvbox.h> | 26 | #include <qvbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <qbuttongroup.h> |
28 | #include <qvgroupbox.h> | 28 | #include <qvgroupbox.h> |
29 | #include <qwidgetstack.h> | 29 | #include <qwidgetstack.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kglobal.h> | 33 | #include <kglobal.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kiconloader.h> | 35 | #include <kiconloader.h> |
36 | #include <kmessagebox.h> | 36 | #include <kmessagebox.h> |
37 | #include <kfiledialog.h> | 37 | #include <kfiledialog.h> |
38 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
39 | 39 | ||
40 | #include <libkcal/event.h> | 40 | #include <libkcal/event.h> |
41 | 41 | ||
42 | #include <libkdepim/kdateedit.h> | 42 | #include <libkdepim/kdateedit.h> |
43 | 43 | ||
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | 45 | ||
46 | #include "koeditorgeneralevent.h" | 46 | #include "koeditorgeneralevent.h" |
47 | #include "kolocationbox.h" | 47 | #include "kolocationbox.h" |
48 | 48 | ||
49 | KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, | 49 | KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, |
50 | const char* name) : | 50 | const char* name) : |
51 | KOEditorGeneral( parent, name) | 51 | KOEditorGeneral( parent, name) |
52 | { | 52 | { |
53 | mTemplate = false; | 53 | mTemplate = false; |
54 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 54 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
55 | SLOT(setDuration())); | 55 | SLOT(setDuration())); |
56 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 56 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
57 | SLOT(emitDateTimeStr())); | 57 | SLOT(emitDateTimeStr())); |
58 | } | 58 | } |
59 | 59 | ||
60 | KOEditorGeneralEvent::~KOEditorGeneralEvent() | 60 | KOEditorGeneralEvent::~KOEditorGeneralEvent() |
61 | { | 61 | { |
62 | } | 62 | } |
63 | 63 | ||
64 | void KOEditorGeneralEvent::finishSetup() | 64 | void KOEditorGeneralEvent::finishSetup() |
65 | { | 65 | { |
66 | 66 | ||
67 | //disabled | 67 | //disabled |
68 | // QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); | 68 | // QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); |
69 | // QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); | 69 | // QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); |
70 | // QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); | 70 | // QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); |
71 | // QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); | 71 | // QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); |
72 | // QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); | 72 | // QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); |
73 | // QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); | 73 | // QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); |
74 | // QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); | 74 | // QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); |
75 | // QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); | 75 | // QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); |
76 | // QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); | 76 | // QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); |
77 | // QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); | 77 | // QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); |
78 | // QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); | 78 | // QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); | 82 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); |
83 | mSummaryEdit->setFocus(); | 83 | mSummaryEdit->setFocus(); |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) | 86 | void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) |
87 | { | 87 | { |
88 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 88 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); |
89 | 89 | ||
90 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 90 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, |
91 | i18n("Date && Time"),parent); | 91 | i18n("Date && Time"),parent); |
92 | timeLayout->addWidget(timeGroupBox); | 92 | timeLayout->addWidget(timeGroupBox); |
93 | 93 | ||
94 | timeGroupBox->layout()->setSpacing( 0 ); | 94 | timeGroupBox->layout()->setSpacing( 0 ); |
95 | timeGroupBox->layout()->setMargin( 5 ); | 95 | timeGroupBox->layout()->setMargin( 5 ); |
96 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 96 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); |
97 | 97 | ||
98 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); | 98 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); |
99 | layoutTimeBox->setSpacing(topLayout->spacing()); | 99 | layoutTimeBox->setSpacing(topLayout->spacing()); |
100 | 100 | ||
101 | mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); | 101 | mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); |
102 | layoutTimeBox->addWidget(mStartDateLabel,0,0); | 102 | layoutTimeBox->addWidget(mStartDateLabel,0,0); |
103 | 103 | ||
104 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 104 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
105 | layoutTimeBox->addWidget(mStartDateEdit,0,1); | 105 | layoutTimeBox->addWidget(mStartDateEdit,0,1); |
106 | 106 | ||
107 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 107 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
108 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); | 108 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); |
109 | 109 | ||
110 | 110 | ||
111 | mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); | 111 | mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); |
112 | layoutTimeBox->addWidget(mEndDateLabel,1,0); | 112 | layoutTimeBox->addWidget(mEndDateLabel,1,0); |
113 | 113 | ||
114 | mEndDateEdit = new KDateEdit(timeBoxFrame); | 114 | mEndDateEdit = new KDateEdit(timeBoxFrame); |
115 | layoutTimeBox->addWidget(mEndDateEdit,1,1); | 115 | layoutTimeBox->addWidget(mEndDateEdit,1,1); |
116 | 116 | ||
117 | mEndTimeEdit = new KOTimeEdit(timeBoxFrame); | 117 | mEndTimeEdit = new KOTimeEdit(timeBoxFrame); |
118 | layoutTimeBox->addWidget(mEndTimeEdit,1,2); | 118 | layoutTimeBox->addWidget(mEndTimeEdit,1,2); |
119 | QWidget* duration = new QWidget( timeBoxFrame ); | 119 | QWidget* duration = new QWidget( timeBoxFrame ); |
120 | QHBoxLayout *flagsBox = new QHBoxLayout( duration ); | 120 | QHBoxLayout *flagsBox = new QHBoxLayout( duration ); |
121 | mNoTimeButton = new QCheckBox(i18n("Allday"),duration); | 121 | mNoTimeButton = new QCheckBox(i18n("Allday"),duration); |
122 | flagsBox->addWidget(mNoTimeButton); | 122 | flagsBox->addWidget(mNoTimeButton); |
123 | connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); | 123 | connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); |
124 | mDurationLabel = new QLabel( duration ); | 124 | mDurationLabel = new QLabel( duration ); |
125 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 125 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
126 | //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); | 126 | //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); |
127 | //} else { | 127 | //} else { |
128 | flagsBox->addWidget( mDurationLabel ); | 128 | flagsBox->addWidget( mDurationLabel ); |
129 | //} | 129 | //} |
130 | flagsBox->setStretchFactor(mDurationLabel, 10 ); | 130 | flagsBox->setStretchFactor(mDurationLabel, 10 ); |
131 | mDurationLabel->setAlignment( AlignRight | AlignVCenter); | 131 | mDurationLabel->setAlignment( AlignRight | AlignVCenter); |
132 | layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); | 132 | layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); |
133 | 133 | ||
134 | // time widgets are checked if they contain a valid time | 134 | // time widgets are checked if they contain a valid time |
135 | connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), | 135 | connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), |
136 | this, SLOT(startTimeChanged(QTime))); | 136 | this, SLOT(startTimeChanged(QTime))); |
137 | connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), | 137 | connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), |
138 | this, SLOT(endTimeChanged(QTime))); | 138 | this, SLOT(endTimeChanged(QTime))); |
139 | 139 | ||
140 | // date widgets are checked if they contain a valid date | 140 | // date widgets are checked if they contain a valid date |
141 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), | 141 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), |
142 | this, SLOT(startDateChanged(QDate))); | 142 | this, SLOT(startDateChanged(QDate))); |
143 | connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), | 143 | connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), |
144 | this, SLOT(endDateChanged(QDate))); | 144 | this, SLOT(endDateChanged(QDate))); |
145 | } | 145 | } |
146 | 146 | ||
147 | void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) | 147 | void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) |
148 | { | 148 | { |
149 | QBoxLayout *classLayout = new QHBoxLayout(topLayout); | 149 | QBoxLayout *classLayout = new QHBoxLayout(topLayout); |
150 | 150 | ||
151 | QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); | 151 | QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); |
152 | classLayout->addWidget(freeTimeLabel); | 152 | classLayout->addWidget(freeTimeLabel); |
153 | 153 | ||
154 | mFreeTimeCombo = new QComboBox(false, parent); | 154 | mFreeTimeCombo = new QComboBox(false, parent); |
155 | mFreeTimeCombo->insertItem(i18n("Busy")); | 155 | mFreeTimeCombo->insertItem(i18n("Busy")); |
156 | mFreeTimeCombo->insertItem(i18n("Free")); | 156 | mFreeTimeCombo->insertItem(i18n("Free")); |
157 | classLayout->addWidget(mFreeTimeCombo); | 157 | classLayout->addWidget(mFreeTimeCombo); |
158 | } | 158 | } |
159 | 159 | ||
160 | void KOEditorGeneralEvent::timeStuffDisable(bool disable) | 160 | void KOEditorGeneralEvent::timeStuffDisable(bool disable) |
161 | { | 161 | { |
162 | mStartTimeEdit->setEnabled( !disable ); | 162 | mStartTimeEdit->setEnabled( !disable ); |
163 | mEndTimeEdit->setEnabled( !disable ); | 163 | mEndTimeEdit->setEnabled( !disable ); |
164 | 164 | ||
165 | setDuration(); | 165 | setDuration(); |
166 | emitDateTimeStr(); | 166 | emitDateTimeStr(); |
167 | } | 167 | } |
168 | 168 | ||
169 | void KOEditorGeneralEvent::dontAssociateTime(bool noTime) | 169 | void KOEditorGeneralEvent::dontAssociateTime(bool noTime) |
170 | { | 170 | { |
171 | timeStuffDisable(noTime); | 171 | timeStuffDisable(noTime); |
172 | //if(alarmButton->isChecked()) alarmStuffDisable(noTime); | 172 | //if(alarmButton->isChecked()) alarmStuffDisable(noTime); |
173 | allDayChanged(noTime); | 173 | allDayChanged(noTime); |
174 | } | 174 | } |
175 | 175 | ||
176 | void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) | 176 | void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) |
177 | { | 177 | { |
178 | // kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; | 178 | // kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; |
179 | if ( !mTemplate ) | 179 | if ( !mTemplate ) |
180 | mStartDateEdit->setDate(start.date()); | 180 | mStartDateEdit->setDate(start.date()); |
181 | // KTimeEdit seems to emit some signals when setTime() is called. | 181 | // KTimeEdit seems to emit some signals when setTime() is called. |
182 | mStartTimeEdit->blockSignals( true ); | 182 | mStartTimeEdit->blockSignals( true ); |
183 | mStartTimeEdit->setTime(start.time()); | 183 | mStartTimeEdit->setTime(start.time()); |
184 | mStartTimeEdit->blockSignals( false ); | 184 | mStartTimeEdit->blockSignals( false ); |
185 | if ( !mTemplate ) | 185 | if ( !mTemplate ) |
186 | mEndDateEdit->setDate(end.date()); | 186 | mEndDateEdit->setDate(end.date()); |
187 | mEndTimeEdit->setTime(end.time()); | 187 | mEndTimeEdit->setTime(end.time()); |
188 | 188 | ||
189 | mCurrStartDateTime = start; | 189 | mCurrStartDateTime = start; |
190 | mCurrEndDateTime = end; | 190 | mCurrEndDateTime = end; |
191 | 191 | ||
192 | setDuration(); | 192 | setDuration(); |
193 | emitDateTimeStr(); | 193 | emitDateTimeStr(); |
194 | } | 194 | } |
195 | 195 | ||
196 | void KOEditorGeneralEvent::startTimeChanged(QTime newtime) | 196 | void KOEditorGeneralEvent::startTimeChanged(QTime newtime) |
197 | { | 197 | { |
198 | kdDebug() << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl; | 198 | kdDebug() << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl; |
199 | 199 | ||
200 | int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime); | 200 | int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime); |
201 | 201 | ||
202 | mCurrStartDateTime.setTime(newtime); | 202 | mCurrStartDateTime.setTime(newtime); |
203 | 203 | ||
204 | // adjust end time so that the event has the same duration as before. | 204 | // adjust end time so that the event has the same duration as before. |
205 | mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep); | 205 | mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep); |
206 | mEndTimeEdit->setTime(mCurrEndDateTime.time()); | 206 | mEndTimeEdit->setTime(mCurrEndDateTime.time()); |
207 | mEndDateEdit->setDate(mCurrEndDateTime.date()); | 207 | mEndDateEdit->setDate(mCurrEndDateTime.date()); |
208 | 208 | ||
209 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); | 209 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); |
210 | } | 210 | } |
211 | 211 | ||
212 | void KOEditorGeneralEvent::endTimeChanged(QTime newtime) | 212 | void KOEditorGeneralEvent::endTimeChanged(QTime newtime) |
213 | { | 213 | { |
214 | // kdDebug() << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl; | 214 | // kdDebug() << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl; |
215 | 215 | ||
216 | QDateTime newdt(mCurrEndDateTime.date(), newtime); | 216 | QDateTime newdt(mCurrEndDateTime.date(), newtime); |
217 | mCurrEndDateTime = newdt; | 217 | mCurrEndDateTime = newdt; |
218 | 218 | ||
219 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); | 219 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); |
220 | } | 220 | } |
221 | 221 | ||
222 | void KOEditorGeneralEvent::startDateChanged(QDate newdate) | 222 | void KOEditorGeneralEvent::startDateChanged(QDate newdate) |
223 | { | 223 | { |
224 | int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime); | 224 | int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime); |
225 | 225 | ||
226 | mCurrStartDateTime.setDate(newdate); | 226 | mCurrStartDateTime.setDate(newdate); |
227 | 227 | ||
228 | // adjust end date so that the event has the same duration as before | 228 | // adjust end date so that the event has the same duration as before |
229 | mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); | 229 | mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); |
230 | mEndDateEdit->setDate(mCurrEndDateTime.date()); | 230 | mEndDateEdit->setDate(mCurrEndDateTime.date()); |
231 | 231 | ||
232 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); | 232 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); |
233 | } | 233 | } |
234 | 234 | ||
235 | void KOEditorGeneralEvent::endDateChanged(QDate newdate) | 235 | void KOEditorGeneralEvent::endDateChanged(QDate newdate) |
236 | { | 236 | { |
237 | QDateTime newdt(newdate, mCurrEndDateTime.time()); | 237 | QDateTime newdt(newdate, mCurrEndDateTime.time()); |
238 | 238 | ||
239 | if(newdt < mCurrStartDateTime) { | 239 | if(newdt < mCurrStartDateTime) { |
240 | // oops, we can't let that happen. | 240 | // oops, we can't let that happen. |
241 | newdt = mCurrStartDateTime; | 241 | newdt = mCurrStartDateTime; |
242 | mEndDateEdit->setDate(newdt.date()); | 242 | mEndDateEdit->setDate(newdt.date()); |
243 | mEndTimeEdit->setTime(newdt.time()); | 243 | mEndTimeEdit->setTime(newdt.time()); |
244 | } | 244 | } |
245 | mCurrEndDateTime = newdt; | 245 | mCurrEndDateTime = newdt; |
246 | 246 | ||
247 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); | 247 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); |
248 | } | 248 | } |
249 | 249 | ||
250 | void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay) | 250 | void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay) |
251 | { | 251 | { |
252 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); | 252 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); |
253 | mLocationEdit->load(KOLocationBox::LOCATION); | 253 | mLocationEdit->load(KOLocationBox::LOCATION); |
254 | KOEditorGeneral::setDefaults(allDay); | 254 | KOEditorGeneral::setDefaults(allDay); |
255 | 255 | ||
256 | mNoTimeButton->setChecked(allDay); | 256 | mNoTimeButton->setChecked(allDay); |
257 | timeStuffDisable(allDay); | 257 | timeStuffDisable(allDay); |
258 | mFreeTimeCombo->setCurrentItem( 0 ); | 258 | mFreeTimeCombo->setCurrentItem( 0 ); |
259 | setDateTimes(from,to); | 259 | setDateTimes(from,to); |
260 | } | 260 | } |
261 | 261 | ||
262 | void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl ) | 262 | void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl ) |
263 | { | 263 | { |
264 | QString tmpStr; | 264 | QString tmpStr; |
265 | 265 | ||
266 | mTemplate = tmpl; | 266 | mTemplate = tmpl; |
267 | // the rest is for the events only | 267 | // the rest is for the events only |
268 | mNoTimeButton->setChecked(event->doesFloat()); | 268 | mNoTimeButton->setChecked(event->doesFloat()); |
269 | timeStuffDisable(event->doesFloat()); | 269 | timeStuffDisable(event->doesFloat()); |
270 | 270 | ||
271 | setDateTimes(event->dtStart(),event->dtEnd()); | 271 | setDateTimes(event->dtStart(),event->dtEnd()); |
272 | 272 | ||
273 | mTemplate = false; | 273 | mTemplate = false; |
274 | switch( event->transparency() ) { | 274 | switch( event->transparency() ) { |
275 | case Event::Transparent: | 275 | case Event::Transparent: |
276 | mFreeTimeCombo->setCurrentItem(1); | 276 | mFreeTimeCombo->setCurrentItem(1); |
277 | break; | 277 | break; |
278 | case Event::Opaque: | 278 | case Event::Opaque: |
279 | mFreeTimeCombo->setCurrentItem(0); | 279 | mFreeTimeCombo->setCurrentItem(0); |
280 | break; | 280 | break; |
281 | } | 281 | } |
282 | 282 | ||
283 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); | 283 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); |
284 | mLocationEdit->load(KOLocationBox::LOCATION); | 284 | mLocationEdit->load(KOLocationBox::LOCATION); |
285 | readIncidence(event); | 285 | readIncidence(event); |
286 | } | 286 | } |
287 | 287 | ||
288 | void KOEditorGeneralEvent::writeEvent(Event *event) | 288 | void KOEditorGeneralEvent::writeEvent(Event *event) |
289 | { | 289 | { |
290 | // kdDebug() << "KOEditorGeneralEvent::writeEvent()" << endl; | 290 | // kdDebug() << "KOEditorGeneralEvent::writeEvent()" << endl; |
291 | 291 | ||
292 | writeIncidence(event); | 292 | writeIncidence(event); |
293 | 293 | ||
294 | QDate tmpDate; | 294 | QDate tmpDate; |
295 | QTime tmpTime; | 295 | QTime tmpTime; |
296 | QDateTime tmpDT; | 296 | QDateTime tmpDT; |
297 | 297 | ||
298 | // temp. until something better happens. | 298 | // temp. until something better happens. |
299 | QString tmpStr; | 299 | QString tmpStr; |
300 | 300 | ||
301 | if (mNoTimeButton->isChecked()) { | 301 | if (mNoTimeButton->isChecked()) { |
302 | event->setFloats(true); | 302 | event->setFloats(true); |
303 | // need to change this. | 303 | // need to change this. |
304 | tmpDate = mStartDateEdit->date(); | 304 | tmpDate = mStartDateEdit->date(); |
305 | tmpTime.setHMS(0,0,0); | 305 | tmpTime.setHMS(0,0,0); |
306 | tmpDT.setDate(tmpDate); | 306 | tmpDT.setDate(tmpDate); |
307 | tmpDT.setTime(tmpTime); | 307 | tmpDT.setTime(tmpTime); |
308 | event->setDtStart(tmpDT); | 308 | event->setDtStart(tmpDT); |
309 | 309 | ||
310 | tmpDate = mEndDateEdit->date(); | 310 | tmpDate = mEndDateEdit->date(); |
311 | tmpTime.setHMS(0,0,0); | 311 | tmpTime.setHMS(0,0,0); |
312 | tmpDT.setDate(tmpDate); | 312 | tmpDT.setDate(tmpDate); |
313 | tmpDT.setTime(tmpTime); | 313 | tmpDT.setTime(tmpTime); |
314 | event->setDtEnd(tmpDT); | 314 | event->setDtEnd(tmpDT); |
315 | } else { | 315 | } else { |
316 | event->setFloats(false); | 316 | event->setFloats(false); |
317 | 317 | ||
318 | // set date/time end | 318 | // set date/time end |
319 | tmpDate = mEndDateEdit->date(); | 319 | tmpDate = mEndDateEdit->date(); |
320 | tmpTime = mEndTimeEdit->getTime(); | 320 | tmpTime = mEndTimeEdit->getTime(); |
321 | tmpDT.setDate(tmpDate); | 321 | tmpDT.setDate(tmpDate); |
322 | tmpDT.setTime(tmpTime); | 322 | tmpDT.setTime(tmpTime); |
323 | event->setDtEnd(tmpDT); | 323 | event->setDtEnd(tmpDT); |
324 | 324 | ||
325 | // set date/time start | 325 | // set date/time start |
326 | tmpDate = mStartDateEdit->date(); | 326 | tmpDate = mStartDateEdit->date(); |
327 | tmpTime = mStartTimeEdit->getTime(); | 327 | tmpTime = mStartTimeEdit->getTime(); |
328 | tmpDT.setDate(tmpDate); | 328 | tmpDT.setDate(tmpDate); |
329 | tmpDT.setTime(tmpTime); | 329 | tmpDT.setTime(tmpTime); |
330 | event->setDtStart(tmpDT); | 330 | event->setDtStart(tmpDT); |
331 | } // check for float | 331 | } // check for float |
332 | mSummaryEdit->save(KOLocationBox::SUMMARYEVENT); | 332 | mSummaryEdit->save(KOLocationBox::SUMMARYEVENT); |
333 | 333 | ||
334 | event->setTransparency(mFreeTimeCombo->currentItem() > 0 | 334 | event->setTransparency(mFreeTimeCombo->currentItem() > 0 |
335 | ? KCal::Event::Transparent | 335 | ? KCal::Event::Transparent |
336 | : KCal::Event::Opaque); | 336 | : KCal::Event::Opaque); |
337 | 337 | ||
338 | // kdDebug() << "KOEditorGeneralEvent::writeEvent() done" << endl; | 338 | // kdDebug() << "KOEditorGeneralEvent::writeEvent() done" << endl; |
339 | } | 339 | } |
340 | 340 | ||
341 | void KOEditorGeneralEvent::setDuration() | 341 | void KOEditorGeneralEvent::setDuration() |
342 | { | 342 | { |
343 | QString tmpStr = "", catStr; | 343 | QString tmpStr = "", catStr; |
344 | int hourdiff, minutediff; | 344 | int hourdiff, minutediff; |
345 | // end<date is an accepted temporary state while typing, but don't show | 345 | // end<date is an accepted temporary state while typing, but don't show |
346 | // any duration if this happens | 346 | // any duration if this happens |
347 | if(mCurrEndDateTime >= mCurrStartDateTime) { | 347 | if(mCurrEndDateTime >= mCurrStartDateTime) { |
348 | 348 | ||
349 | if (mNoTimeButton->isChecked()) { | 349 | if (mNoTimeButton->isChecked()) { |
350 | int daydiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) + 1; | 350 | int daydiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) + 1; |
351 | tmpStr = i18n("Duration: "); | 351 | tmpStr = i18n("Duration: "); |
352 | tmpStr.append(i18n("1 Day","%n Days",daydiff)); | 352 | tmpStr.append(i18n("1 Day","%n Days",daydiff)); |
353 | } else { | 353 | } else { |
354 | int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime ); | 354 | int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime ); |
355 | hourdiff = secto / 3600; | 355 | hourdiff = secto / 3600; |
356 | minutediff = (secto/60 ) % 60; | 356 | minutediff = (secto/60 ) % 60; |
357 | if (hourdiff || minutediff){ | 357 | if (hourdiff || minutediff){ |
358 | tmpStr = i18n("Duration: "); | 358 | tmpStr = i18n("Duration: "); |
359 | if (hourdiff){ | 359 | if (hourdiff){ |
360 | catStr = i18n("1 h","%n h",hourdiff); | 360 | catStr = i18n("1 h","%n h",hourdiff); |
361 | tmpStr.append(catStr); | 361 | tmpStr.append(catStr); |
362 | } | 362 | } |
363 | if (hourdiff && minutediff){ | 363 | if (hourdiff && minutediff){ |
364 | tmpStr += i18n(", "); | 364 | tmpStr += i18n(", "); |
365 | } | 365 | } |
366 | if (minutediff){ | 366 | if (minutediff){ |
367 | catStr = i18n("1 min","%n min",minutediff); | 367 | catStr = i18n("1 min","%n min",minutediff); |
368 | tmpStr += catStr; | 368 | tmpStr += catStr; |
369 | } | 369 | } |
370 | } else tmpStr = ""; | 370 | } else tmpStr = ""; |
371 | } | 371 | } |
372 | } | 372 | } |
373 | mDurationLabel->setText(tmpStr); | 373 | mDurationLabel->setText(tmpStr); |
374 | } | 374 | } |
375 | 375 | ||
376 | void KOEditorGeneralEvent::emitDateTimeStr() | 376 | void KOEditorGeneralEvent::emitDateTimeStr() |
377 | { | 377 | { |
378 | KLocale *l = KGlobal::locale(); | 378 | KLocale *l = KGlobal::locale(); |
379 | 379 | ||
380 | QString from,to; | 380 | QString from,to; |
381 | if (mNoTimeButton->isChecked()) { | 381 | if (mNoTimeButton->isChecked()) { |
382 | from = l->formatDate(mCurrStartDateTime.date()); | 382 | from = l->formatDate(mCurrStartDateTime.date()); |
383 | to = l->formatDate(mCurrEndDateTime.date()); | 383 | to = l->formatDate(mCurrEndDateTime.date()); |
384 | } else { | 384 | } else { |
385 | from = l->formatDateTime(mCurrStartDateTime); | 385 | from = l->formatDateTime(mCurrStartDateTime); |
386 | to = l->formatDateTime(mCurrEndDateTime); | 386 | to = l->formatDateTime(mCurrEndDateTime); |
387 | } | 387 | } |
388 | 388 | ||
389 | QString str = i18n("From: %1 To: %2 %3").arg(from).arg(to) | 389 | QString str = i18n("From: %1 To: %2 %3").arg(from).arg(to) |
390 | .arg(mDurationLabel->text()); | 390 | .arg(mDurationLabel->text()); |
391 | 391 | ||
392 | emit dateTimeStrChanged(str); | 392 | emit dateTimeStrChanged(str); |
393 | } | 393 | } |
394 | 394 | ||
395 | bool KOEditorGeneralEvent::validateInput() | 395 | bool KOEditorGeneralEvent::validateInput() |
396 | { | 396 | { |
397 | // kdDebug() << "KOEditorGeneralEvent::validateInput()" << endl; | ||
398 | |||
399 | if (!mNoTimeButton->isChecked()) { | ||
400 | if (!mStartTimeEdit->inputIsValid()) { | ||
401 | KMessageBox::sorry( 0, | ||
402 | i18n("Please specify a valid start time, for example '%1'.") | ||
403 | .arg( KGlobal::locale()->formatTime( QTime::currentTime() ) ) ); | ||
404 | return false; | ||
405 | } | ||
406 | |||
407 | if (!mEndTimeEdit->inputIsValid()) { | ||
408 | KMessageBox::sorry( 0, | ||
409 | i18n("Please specify a valid end time, for example '%1'.") | ||
410 | .arg( KGlobal::locale()->formatTime( QTime::currentTime() ) ) ); | ||
411 | return false; | ||
412 | } | ||
413 | } | ||
414 | 397 | ||
415 | if (!mStartDateEdit->inputIsValid()) { | 398 | if (!mStartDateEdit->inputIsValid()) { |
416 | KMessageBox::sorry( 0, | 399 | KMessageBox::sorry( 0, |
417 | i18n("Please specify a valid start date, for example '%1'.") | 400 | i18n("Please specify a valid start date, for example '%1'.") |
418 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); | 401 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); |
419 | return false; | 402 | return false; |
420 | } | 403 | } |
421 | 404 | ||
422 | if (!mEndDateEdit->inputIsValid()) { | 405 | if (!mEndDateEdit->inputIsValid()) { |
423 | KMessageBox::sorry( 0, | 406 | KMessageBox::sorry( 0, |
424 | i18n("Please specify a valid end date, for example '%1'.") | 407 | i18n("Please specify a valid end date, for example '%1'.") |
425 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); | 408 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); |
426 | return false; | 409 | return false; |
427 | } | 410 | } |
428 | 411 | ||
429 | QDateTime startDt,endDt; | 412 | QDateTime startDt,endDt; |
430 | startDt.setDate(mStartDateEdit->date()); | 413 | startDt.setDate(mStartDateEdit->date()); |
431 | endDt.setDate(mEndDateEdit->date()); | 414 | endDt.setDate(mEndDateEdit->date()); |
432 | if (!mNoTimeButton->isChecked()) { | 415 | if (!mNoTimeButton->isChecked()) { |
433 | startDt.setTime(mStartTimeEdit->getTime()); | 416 | startDt.setTime(mStartTimeEdit->getTime()); |
434 | endDt.setTime(mEndTimeEdit->getTime()); | 417 | endDt.setTime(mEndTimeEdit->getTime()); |
435 | } | 418 | } |
436 | 419 | ||
437 | if (startDt > endDt) { | 420 | if (startDt > endDt) { |
438 | KMessageBox::sorry(0,i18n("The event ends before it starts.\n" | 421 | KMessageBox::sorry(0,i18n("The event ends before it starts.\n" |
439 | "Please correct dates and times.")); | 422 | "Please correct dates and times.")); |
440 | return false; | 423 | return false; |
441 | } | 424 | } |
442 | 425 | ||
443 | return KOEditorGeneral::validateInput(); | 426 | return KOEditorGeneral::validateInput(); |
444 | } | 427 | } |
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 7db7da0..158a7d3 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -1,466 +1,454 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.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 | 32 | ||
33 | #include <kglobal.h> | 33 | #include <kglobal.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kiconloader.h> | 35 | #include <kiconloader.h> |
36 | #include <kmessagebox.h> | 36 | #include <kmessagebox.h> |
37 | #include <kdebug.h> | 37 | #include <kdebug.h> |
38 | #include <krestrictedline.h> | 38 | #include <krestrictedline.h> |
39 | #include <kstandarddirs.h> | 39 | #include <kstandarddirs.h> |
40 | #include <kfiledialog.h> | 40 | #include <kfiledialog.h> |
41 | 41 | ||
42 | #include <libkcal/todo.h> | 42 | #include <libkcal/todo.h> |
43 | 43 | ||
44 | #include <libkdepim/kdateedit.h> | 44 | #include <libkdepim/kdateedit.h> |
45 | 45 | ||
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "ktimeedit.h" | 47 | #include "ktimeedit.h" |
48 | 48 | ||
49 | #include "koeditorgeneraltodo.h" | 49 | #include "koeditorgeneraltodo.h" |
50 | #include "kolocationbox.h" | 50 | #include "kolocationbox.h" |
51 | 51 | ||
52 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, | 52 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, |
53 | const char* name) | 53 | const char* name) |
54 | : KOEditorGeneral( parent, name) | 54 | : KOEditorGeneral( parent, name) |
55 | { | 55 | { |
56 | } | 56 | } |
57 | 57 | ||
58 | KOEditorGeneralTodo::~KOEditorGeneralTodo() | 58 | KOEditorGeneralTodo::~KOEditorGeneralTodo() |
59 | { | 59 | { |
60 | } | 60 | } |
61 | 61 | ||
62 | void KOEditorGeneralTodo::finishSetup() | 62 | void KOEditorGeneralTodo::finishSetup() |
63 | { | 63 | { |
64 | 64 | ||
65 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); | 65 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); |
66 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); | 66 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); |
67 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); | 67 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); |
68 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); | 68 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); |
69 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); | 69 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); |
70 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); | 70 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); |
71 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); | 71 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); |
72 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); | 72 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); |
73 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); | 73 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); |
74 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); | 74 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); |
75 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); | 75 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); |
76 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); | 76 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); |
77 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); | 77 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); |
78 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); | 78 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); |
79 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 79 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
80 | mSummaryEdit->setFocus(); | 80 | mSummaryEdit->setFocus(); |
81 | } | 81 | } |
82 | 82 | ||
83 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) | 83 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) |
84 | { | 84 | { |
85 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 85 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); |
86 | 86 | ||
87 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 87 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, |
88 | i18n("Date && Time"),parent); | 88 | i18n("Date && Time"),parent); |
89 | timeLayout->addWidget(timeGroupBox); | 89 | timeLayout->addWidget(timeGroupBox); |
90 | timeGroupBox->layout()->setSpacing( 0 ); | 90 | timeGroupBox->layout()->setSpacing( 0 ); |
91 | timeGroupBox->layout()->setMargin( 5 ); | 91 | timeGroupBox->layout()->setMargin( 5 ); |
92 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 92 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); |
93 | 93 | ||
94 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); | 94 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); |
95 | layoutTimeBox->setSpacing(topLayout->spacing()); | 95 | layoutTimeBox->setSpacing(topLayout->spacing()); |
96 | layoutTimeBox->setColStretch( 1, 1 ); | 96 | layoutTimeBox->setColStretch( 1, 1 ); |
97 | 97 | ||
98 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); | 98 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); |
99 | layoutTimeBox->addWidget(mDueCheck,0,0); | 99 | layoutTimeBox->addWidget(mDueCheck,0,0); |
100 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); | 100 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); |
101 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); | 101 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); |
102 | 102 | ||
103 | 103 | ||
104 | mDueDateEdit = new KDateEdit(timeBoxFrame); | 104 | mDueDateEdit = new KDateEdit(timeBoxFrame); |
105 | layoutTimeBox->addWidget(mDueDateEdit,0,1); | 105 | layoutTimeBox->addWidget(mDueDateEdit,0,1); |
106 | 106 | ||
107 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); | 107 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); |
108 | layoutTimeBox->addWidget(mDueTimeEdit,0,2); | 108 | layoutTimeBox->addWidget(mDueTimeEdit,0,2); |
109 | 109 | ||
110 | 110 | ||
111 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); | 111 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); |
112 | layoutTimeBox->addWidget(mStartCheck,1,0); | 112 | layoutTimeBox->addWidget(mStartCheck,1,0); |
113 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); | 113 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); |
114 | 114 | ||
115 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 115 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
116 | layoutTimeBox->addWidget(mStartDateEdit,1,1); | 116 | layoutTimeBox->addWidget(mStartDateEdit,1,1); |
117 | 117 | ||
118 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 118 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
119 | layoutTimeBox->addWidget(mStartTimeEdit,1,2); | 119 | layoutTimeBox->addWidget(mStartTimeEdit,1,2); |
120 | 120 | ||
121 | 121 | ||
122 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); | 122 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); |
123 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); | 123 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); |
124 | 124 | ||
125 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); | 125 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); |
126 | 126 | ||
127 | // some more layouting | 127 | // some more layouting |
128 | //layoutTimeBox->setColStretch(3,1); | 128 | //layoutTimeBox->setColStretch(3,1); |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | 132 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) |
133 | { | 133 | { |
134 | mCompletedCombo = new QComboBox(parent); | 134 | mCompletedCombo = new QComboBox(parent); |
135 | // xgettext:no-c-format | 135 | // xgettext:no-c-format |
136 | mCompletedCombo->insertItem(i18n(" 0 %")); | 136 | mCompletedCombo->insertItem(i18n(" 0 %")); |
137 | // xgettext:no-c-format | 137 | // xgettext:no-c-format |
138 | mCompletedCombo->insertItem(i18n(" 20 %")); | 138 | mCompletedCombo->insertItem(i18n(" 20 %")); |
139 | // xgettext:no-c-format | 139 | // xgettext:no-c-format |
140 | mCompletedCombo->insertItem(i18n(" 40 %")); | 140 | mCompletedCombo->insertItem(i18n(" 40 %")); |
141 | // xgettext:no-c-format | 141 | // xgettext:no-c-format |
142 | mCompletedCombo->insertItem(i18n(" 60 %")); | 142 | mCompletedCombo->insertItem(i18n(" 60 %")); |
143 | // xgettext:no-c-format | 143 | // xgettext:no-c-format |
144 | mCompletedCombo->insertItem(i18n(" 80 %")); | 144 | mCompletedCombo->insertItem(i18n(" 80 %")); |
145 | // xgettext:no-c-format | 145 | // xgettext:no-c-format |
146 | mCompletedCombo->insertItem(i18n("100 %")); | 146 | mCompletedCombo->insertItem(i18n("100 %")); |
147 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); | 147 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); |
148 | topLayout->addWidget(mCompletedCombo); | 148 | topLayout->addWidget(mCompletedCombo); |
149 | 149 | ||
150 | mCompletedLabel = new QLabel(i18n("completed"),parent); | 150 | mCompletedLabel = new QLabel(i18n("completed"),parent); |
151 | topLayout->addWidget(mCompletedLabel); | 151 | topLayout->addWidget(mCompletedLabel); |
152 | } | 152 | } |
153 | 153 | ||
154 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) | 154 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) |
155 | { | 155 | { |
156 | 156 | ||
157 | QHBox* h = new QHBox ( parent ); | 157 | QHBox* h = new QHBox ( parent ); |
158 | topLayout->addWidget( h ); | 158 | topLayout->addWidget( h ); |
159 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); | 159 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); |
160 | // topLayout->addWidget(priorityLabel); | 160 | // topLayout->addWidget(priorityLabel); |
161 | 161 | ||
162 | mPriorityCombo = new QComboBox( h ); | 162 | mPriorityCombo = new QComboBox( h ); |
163 | mPriorityCombo->insertItem(i18n("1 (high)")); | 163 | mPriorityCombo->insertItem(i18n("1 (high)")); |
164 | mPriorityCombo->insertItem(i18n("2")); | 164 | mPriorityCombo->insertItem(i18n("2")); |
165 | mPriorityCombo->insertItem(i18n("3")); | 165 | mPriorityCombo->insertItem(i18n("3")); |
166 | mPriorityCombo->insertItem(i18n("4")); | 166 | mPriorityCombo->insertItem(i18n("4")); |
167 | mPriorityCombo->insertItem(i18n("5 (low)")); | 167 | mPriorityCombo->insertItem(i18n("5 (low)")); |
168 | //topLayout->addWidget(mPriorityCombo); | 168 | //topLayout->addWidget(mPriorityCombo); |
169 | } | 169 | } |
170 | 170 | ||
171 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) | 171 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) |
172 | { | 172 | { |
173 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); | 173 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); |
174 | 174 | ||
175 | initCompletion( parent, statusLayout ); | 175 | initCompletion( parent, statusLayout ); |
176 | 176 | ||
177 | statusLayout->addStretch( 1 ); | 177 | statusLayout->addStretch( 1 ); |
178 | 178 | ||
179 | initPriority( parent, statusLayout ); | 179 | initPriority( parent, statusLayout ); |
180 | } | 180 | } |
181 | 181 | ||
182 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) | 182 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) |
183 | { | 183 | { |
184 | 184 | ||
185 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 185 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
186 | mLocationEdit->load(KOLocationBox::LOCATION); | 186 | mLocationEdit->load(KOLocationBox::LOCATION); |
187 | KOEditorGeneral::setDefaults(allDay); | 187 | KOEditorGeneral::setDefaults(allDay); |
188 | 188 | ||
189 | mTimeButton->setChecked( !allDay ); | 189 | mTimeButton->setChecked( !allDay ); |
190 | if(mTimeButton->isChecked()) { | 190 | if(mTimeButton->isChecked()) { |
191 | mTimeButton->setEnabled(true); | 191 | mTimeButton->setEnabled(true); |
192 | } | 192 | } |
193 | else { | 193 | else { |
194 | mTimeButton->setEnabled(false); | 194 | mTimeButton->setEnabled(false); |
195 | } | 195 | } |
196 | 196 | ||
197 | enableTimeEdits( !allDay ); | 197 | enableTimeEdits( !allDay ); |
198 | 198 | ||
199 | mDueCheck->setChecked(false); | 199 | mDueCheck->setChecked(false); |
200 | enableDueEdit(false); | 200 | enableDueEdit(false); |
201 | 201 | ||
202 | alarmDisable(true); | 202 | alarmDisable(true); |
203 | 203 | ||
204 | mStartCheck->setChecked(false); | 204 | mStartCheck->setChecked(false); |
205 | enableStartEdit(false); | 205 | enableStartEdit(false); |
206 | 206 | ||
207 | mDueDateEdit->setDate(due.date()); | 207 | mDueDateEdit->setDate(due.date()); |
208 | mDueTimeEdit->setTime(due.time()); | 208 | mDueTimeEdit->setTime(due.time()); |
209 | 209 | ||
210 | mStartDateEdit->setDate(QDate::currentDate()); | 210 | mStartDateEdit->setDate(QDate::currentDate()); |
211 | mStartTimeEdit->setTime(QTime::currentTime()); | 211 | mStartTimeEdit->setTime(QTime::currentTime()); |
212 | 212 | ||
213 | mPriorityCombo->setCurrentItem(2); | 213 | mPriorityCombo->setCurrentItem(2); |
214 | mCompletedLabel->setText(i18n("completed"));; | 214 | mCompletedLabel->setText(i18n("completed"));; |
215 | mCompletedCombo->setCurrentItem(0); | 215 | mCompletedCombo->setCurrentItem(0); |
216 | } | 216 | } |
217 | 217 | ||
218 | void KOEditorGeneralTodo::readTodo(Todo *todo) | 218 | void KOEditorGeneralTodo::readTodo(Todo *todo) |
219 | { | 219 | { |
220 | 220 | ||
221 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 221 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
222 | mLocationEdit->load(KOLocationBox::LOCATION); | 222 | mLocationEdit->load(KOLocationBox::LOCATION); |
223 | KOEditorGeneral::readIncidence(todo); | 223 | KOEditorGeneral::readIncidence(todo); |
224 | 224 | ||
225 | QDateTime dueDT; | 225 | QDateTime dueDT; |
226 | 226 | ||
227 | if (todo->hasDueDate()) { | 227 | if (todo->hasDueDate()) { |
228 | enableAlarmEdit(true); | 228 | enableAlarmEdit(true); |
229 | dueDT = todo->dtDue(); | 229 | dueDT = todo->dtDue(); |
230 | mDueDateEdit->setDate(todo->dtDue().date()); | 230 | mDueDateEdit->setDate(todo->dtDue().date()); |
231 | mDueTimeEdit->setTime(todo->dtDue().time()); | 231 | mDueTimeEdit->setTime(todo->dtDue().time()); |
232 | mDueCheck->setChecked(true); | 232 | mDueCheck->setChecked(true); |
233 | } else { | 233 | } else { |
234 | alarmDisable(true); | 234 | alarmDisable(true); |
235 | mDueDateEdit->setEnabled(false); | 235 | mDueDateEdit->setEnabled(false); |
236 | mDueTimeEdit->setEnabled(false); | 236 | mDueTimeEdit->setEnabled(false); |
237 | mDueDateEdit->setDate(QDate::currentDate()); | 237 | mDueDateEdit->setDate(QDate::currentDate()); |
238 | mDueTimeEdit->setTime(QTime::currentTime()); | 238 | mDueTimeEdit->setTime(QTime::currentTime()); |
239 | mDueCheck->setChecked(false); | 239 | mDueCheck->setChecked(false); |
240 | } | 240 | } |
241 | 241 | ||
242 | if (todo->hasStartDate()) { | 242 | if (todo->hasStartDate()) { |
243 | mStartDateEdit->setDate(todo->dtStart().date()); | 243 | mStartDateEdit->setDate(todo->dtStart().date()); |
244 | mStartTimeEdit->setTime(todo->dtStart().time()); | 244 | mStartTimeEdit->setTime(todo->dtStart().time()); |
245 | mStartCheck->setChecked(true); | 245 | mStartCheck->setChecked(true); |
246 | } else { | 246 | } else { |
247 | mStartDateEdit->setEnabled(false); | 247 | mStartDateEdit->setEnabled(false); |
248 | mStartTimeEdit->setEnabled(false); | 248 | mStartTimeEdit->setEnabled(false); |
249 | mStartDateEdit->setDate(QDate::currentDate()); | 249 | mStartDateEdit->setDate(QDate::currentDate()); |
250 | mStartTimeEdit->setTime(QTime::currentTime()); | 250 | mStartTimeEdit->setTime(QTime::currentTime()); |
251 | mStartCheck->setChecked(false); | 251 | mStartCheck->setChecked(false); |
252 | } | 252 | } |
253 | 253 | ||
254 | mTimeButton->setChecked( !todo->doesFloat() ); | 254 | mTimeButton->setChecked( !todo->doesFloat() ); |
255 | 255 | ||
256 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 256 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
257 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 257 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
258 | mCompleted = todo->completed(); | 258 | mCompleted = todo->completed(); |
259 | } | 259 | } |
260 | setCompletedDate(); | 260 | setCompletedDate(); |
261 | 261 | ||
262 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 262 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
263 | } | 263 | } |
264 | 264 | ||
265 | void KOEditorGeneralTodo::writeTodo(Todo *todo) | 265 | void KOEditorGeneralTodo::writeTodo(Todo *todo) |
266 | { | 266 | { |
267 | KOEditorGeneral::writeIncidence(todo); | 267 | KOEditorGeneral::writeIncidence(todo); |
268 | 268 | ||
269 | // temp. until something better happens. | 269 | // temp. until something better happens. |
270 | QString tmpStr; | 270 | QString tmpStr; |
271 | 271 | ||
272 | todo->setHasDueDate(mDueCheck->isChecked()); | 272 | todo->setHasDueDate(mDueCheck->isChecked()); |
273 | todo->setHasStartDate(mStartCheck->isChecked()); | 273 | todo->setHasStartDate(mStartCheck->isChecked()); |
274 | 274 | ||
275 | QDate tmpDate; | 275 | QDate tmpDate; |
276 | QTime tmpTime; | 276 | QTime tmpTime; |
277 | QDateTime tmpDT; | 277 | QDateTime tmpDT; |
278 | if ( mTimeButton->isChecked() ) { | 278 | if ( mTimeButton->isChecked() ) { |
279 | todo->setFloats(false); | 279 | todo->setFloats(false); |
280 | 280 | ||
281 | // set due date/time | 281 | // set due date/time |
282 | tmpDate = mDueDateEdit->date(); | 282 | tmpDate = mDueDateEdit->date(); |
283 | tmpTime = mDueTimeEdit->getTime(); | 283 | tmpTime = mDueTimeEdit->getTime(); |
284 | tmpDT.setDate(tmpDate); | 284 | tmpDT.setDate(tmpDate); |
285 | tmpDT.setTime(tmpTime); | 285 | tmpDT.setTime(tmpTime); |
286 | todo->setDtDue(tmpDT); | 286 | todo->setDtDue(tmpDT); |
287 | 287 | ||
288 | // set start date/time | 288 | // set start date/time |
289 | tmpDate = mStartDateEdit->date(); | 289 | tmpDate = mStartDateEdit->date(); |
290 | tmpTime = mStartTimeEdit->getTime(); | 290 | tmpTime = mStartTimeEdit->getTime(); |
291 | tmpDT.setDate(tmpDate); | 291 | tmpDT.setDate(tmpDate); |
292 | tmpDT.setTime(tmpTime); | 292 | tmpDT.setTime(tmpTime); |
293 | todo->setDtStart(tmpDT); | 293 | todo->setDtStart(tmpDT); |
294 | } else { | 294 | } else { |
295 | todo->setFloats(true); | 295 | todo->setFloats(true); |
296 | 296 | ||
297 | // need to change this. | 297 | // need to change this. |
298 | tmpDate = mDueDateEdit->date(); | 298 | tmpDate = mDueDateEdit->date(); |
299 | tmpTime.setHMS(0,0,0); | 299 | tmpTime.setHMS(0,0,0); |
300 | tmpDT.setDate(tmpDate); | 300 | tmpDT.setDate(tmpDate); |
301 | tmpDT.setTime(tmpTime); | 301 | tmpDT.setTime(tmpTime); |
302 | todo->setDtDue(tmpDT); | 302 | todo->setDtDue(tmpDT); |
303 | 303 | ||
304 | tmpDate = mStartDateEdit->date(); | 304 | tmpDate = mStartDateEdit->date(); |
305 | tmpTime.setHMS(0,0,0); | 305 | tmpTime.setHMS(0,0,0); |
306 | tmpDT.setDate(tmpDate); | 306 | tmpDT.setDate(tmpDate); |
307 | tmpDT.setTime(tmpTime); | 307 | tmpDT.setTime(tmpTime); |
308 | todo->setDtStart(tmpDT); | 308 | todo->setDtStart(tmpDT); |
309 | } | 309 | } |
310 | 310 | ||
311 | todo->setPriority(mPriorityCombo->currentItem()+1); | 311 | todo->setPriority(mPriorityCombo->currentItem()+1); |
312 | 312 | ||
313 | // set completion state | 313 | // set completion state |
314 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); | 314 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); |
315 | 315 | ||
316 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { | 316 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { |
317 | todo->setCompleted(mCompleted); | 317 | todo->setCompleted(mCompleted); |
318 | } | 318 | } |
319 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); | 319 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); |
320 | } | 320 | } |
321 | 321 | ||
322 | void KOEditorGeneralTodo::enableDueEdit(bool enable) | 322 | void KOEditorGeneralTodo::enableDueEdit(bool enable) |
323 | { | 323 | { |
324 | mDueDateEdit->setEnabled( enable ); | 324 | mDueDateEdit->setEnabled( enable ); |
325 | 325 | ||
326 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 326 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
327 | mTimeButton->setEnabled(true); | 327 | mTimeButton->setEnabled(true); |
328 | } | 328 | } |
329 | else { | 329 | else { |
330 | mTimeButton->setEnabled(false); | 330 | mTimeButton->setEnabled(false); |
331 | mTimeButton->setChecked(false); | 331 | mTimeButton->setChecked(false); |
332 | } | 332 | } |
333 | 333 | ||
334 | if (enable) { | 334 | if (enable) { |
335 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); | 335 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); |
336 | } else { | 336 | } else { |
337 | mDueTimeEdit->setEnabled( false ); | 337 | mDueTimeEdit->setEnabled( false ); |
338 | } | 338 | } |
339 | } | 339 | } |
340 | 340 | ||
341 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) | 341 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) |
342 | { | 342 | { |
343 | mStartDateEdit->setEnabled( enable ); | 343 | mStartDateEdit->setEnabled( enable ); |
344 | 344 | ||
345 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 345 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
346 | mTimeButton->setEnabled(true); | 346 | mTimeButton->setEnabled(true); |
347 | } | 347 | } |
348 | else { | 348 | else { |
349 | mTimeButton->setEnabled(false); | 349 | mTimeButton->setEnabled(false); |
350 | mTimeButton->setChecked(false); | 350 | mTimeButton->setChecked(false); |
351 | } | 351 | } |
352 | 352 | ||
353 | if (enable) { | 353 | if (enable) { |
354 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); | 354 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); |
355 | } else { | 355 | } else { |
356 | mStartTimeEdit->setEnabled( false ); | 356 | mStartTimeEdit->setEnabled( false ); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) | 360 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) |
361 | { | 361 | { |
362 | if(mStartCheck->isChecked()) { | 362 | if(mStartCheck->isChecked()) { |
363 | mStartTimeEdit->setEnabled( enable ); | 363 | mStartTimeEdit->setEnabled( enable ); |
364 | } | 364 | } |
365 | if(mDueCheck->isChecked()) { | 365 | if(mDueCheck->isChecked()) { |
366 | mDueTimeEdit->setEnabled( enable ); | 366 | mDueTimeEdit->setEnabled( enable ); |
367 | } | 367 | } |
368 | } | 368 | } |
369 | 369 | ||
370 | void KOEditorGeneralTodo::showAlarm() | 370 | void KOEditorGeneralTodo::showAlarm() |
371 | { | 371 | { |
372 | if ( mDueCheck->isChecked() ) { | 372 | if ( mDueCheck->isChecked() ) { |
373 | alarmDisable(false); | 373 | alarmDisable(false); |
374 | } | 374 | } |
375 | else { | 375 | else { |
376 | alarmDisable(true); | 376 | alarmDisable(true); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | 379 | ||
380 | bool KOEditorGeneralTodo::validateInput() | 380 | bool KOEditorGeneralTodo::validateInput() |
381 | { | 381 | { |
382 | if (mDueCheck->isChecked()) { | 382 | if (mDueCheck->isChecked()) { |
383 | if (!mDueDateEdit->inputIsValid()) { | 383 | if (!mDueDateEdit->inputIsValid()) { |
384 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); | 384 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); |
385 | return false; | 385 | return false; |
386 | } | 386 | } |
387 | if (mTimeButton->isChecked()) { | ||
388 | if (!mDueTimeEdit->inputIsValid()) { | ||
389 | KMessageBox::sorry(0,i18n("Please specify a valid due time.")); | ||
390 | return false; | ||
391 | } | ||
392 | } | ||
393 | } | 387 | } |
394 | 388 | ||
395 | if (mStartCheck->isChecked()) { | 389 | if (mStartCheck->isChecked()) { |
396 | if (!mStartDateEdit->inputIsValid()) { | 390 | if (!mStartDateEdit->inputIsValid()) { |
397 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); | 391 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); |
398 | return false; | 392 | return false; |
399 | } | 393 | } |
400 | if (mTimeButton->isChecked()) { | ||
401 | if (!mStartTimeEdit->inputIsValid()) { | ||
402 | KMessageBox::sorry(0,i18n("Please specify a valid start time.")); | ||
403 | return false; | ||
404 | } | ||
405 | } | ||
406 | } | 394 | } |
407 | 395 | ||
408 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { | 396 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { |
409 | QDateTime startDate; | 397 | QDateTime startDate; |
410 | QDateTime dueDate; | 398 | QDateTime dueDate; |
411 | startDate.setDate(mStartDateEdit->date()); | 399 | startDate.setDate(mStartDateEdit->date()); |
412 | dueDate.setDate(mDueDateEdit->date()); | 400 | dueDate.setDate(mDueDateEdit->date()); |
413 | if (mTimeButton->isChecked()) { | 401 | if (mTimeButton->isChecked()) { |
414 | startDate.setTime(mStartTimeEdit->getTime()); | 402 | startDate.setTime(mStartTimeEdit->getTime()); |
415 | dueDate.setTime(mDueTimeEdit->getTime()); | 403 | dueDate.setTime(mDueTimeEdit->getTime()); |
416 | } | 404 | } |
417 | if (startDate > dueDate) { | 405 | if (startDate > dueDate) { |
418 | KMessageBox::sorry(0, | 406 | KMessageBox::sorry(0, |
419 | i18n("The start date cannot be after the due date.")); | 407 | i18n("The start date cannot be after the due date.")); |
420 | return false; | 408 | return false; |
421 | } | 409 | } |
422 | } | 410 | } |
423 | 411 | ||
424 | return KOEditorGeneral::validateInput(); | 412 | return KOEditorGeneral::validateInput(); |
425 | } | 413 | } |
426 | 414 | ||
427 | void KOEditorGeneralTodo::completedChanged(int index) | 415 | void KOEditorGeneralTodo::completedChanged(int index) |
428 | { | 416 | { |
429 | if (index == 5) { | 417 | if (index == 5) { |
430 | mCompleted = QDateTime::currentDateTime(); | 418 | mCompleted = QDateTime::currentDateTime(); |
431 | } | 419 | } |
432 | setCompletedDate(); | 420 | setCompletedDate(); |
433 | } | 421 | } |
434 | 422 | ||
435 | void KOEditorGeneralTodo::setCompletedDate() | 423 | void KOEditorGeneralTodo::setCompletedDate() |
436 | { | 424 | { |
437 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { | 425 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { |
438 | mCompletedLabel->setText(i18n("completed on %1") | 426 | mCompletedLabel->setText(i18n("completed on %1") |
439 | .arg(KGlobal::locale()->formatDateTime(mCompleted))); | 427 | .arg(KGlobal::locale()->formatDateTime(mCompleted))); |
440 | } else { | 428 | } else { |
441 | mCompletedLabel->setText(i18n("completed")); | 429 | mCompletedLabel->setText(i18n("completed")); |
442 | } | 430 | } |
443 | } | 431 | } |
444 | 432 | ||
445 | void KOEditorGeneralTodo::modified (Todo* todo, int modification) | 433 | void KOEditorGeneralTodo::modified (Todo* todo, int modification) |
446 | { | 434 | { |
447 | switch (modification) { | 435 | switch (modification) { |
448 | case KOGlobals::PRIORITY_MODIFIED: | 436 | case KOGlobals::PRIORITY_MODIFIED: |
449 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 437 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
450 | break; | 438 | break; |
451 | case KOGlobals::COMPLETION_MODIFIED: | 439 | case KOGlobals::COMPLETION_MODIFIED: |
452 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 440 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
453 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 441 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
454 | mCompleted = todo->completed(); | 442 | mCompleted = todo->completed(); |
455 | } | 443 | } |
456 | setCompletedDate(); | 444 | setCompletedDate(); |
457 | break; | 445 | break; |
458 | case KOGlobals::CATEGORY_MODIFIED: | 446 | case KOGlobals::CATEGORY_MODIFIED: |
459 | setCategories (todo->categoriesStr ()); | 447 | setCategories (todo->categoriesStr ()); |
460 | break; | 448 | break; |
461 | case KOGlobals::UNKNOWN_MODIFIED: // fall through | 449 | case KOGlobals::UNKNOWN_MODIFIED: // fall through |
462 | default: | 450 | default: |
463 | readTodo( todo ); | 451 | readTodo( todo ); |
464 | break; | 452 | break; |
465 | } | 453 | } |
466 | } | 454 | } |
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp index f5a1c50..5222ac9 100644 --- a/korganizer/ktimeedit.cpp +++ b/korganizer/ktimeedit.cpp | |||
@@ -1,528 +1,474 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown, Ian Dawes | 3 | Copyright (c) 1999 Preston Brown, Ian Dawes |
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 <qkeycode.h> | 24 | #include <qkeycode.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | #include <qlistbox.h> | ||
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | 30 | ||
30 | #include <kmessagebox.h> | 31 | #include <kmessagebox.h> |
31 | #include <kglobal.h> | 32 | #include <kglobal.h> |
32 | #include <kdebug.h> | 33 | #include <kdebug.h> |
33 | #include <klocale.h> | 34 | #include <klocale.h> |
34 | #include <kpimglobalprefs.h> | 35 | #include <kpimglobalprefs.h> |
35 | 36 | ||
36 | #include "ktimeedit.h" | 37 | #include "ktimeedit.h" |
37 | #include "koprefs.h" | 38 | #include "koprefs.h" |
38 | #include <qvalidator.h> | 39 | #include <qvalidator.h> |
39 | 40 | ||
40 | // Validator for a time value with only hours and minutes (no seconds) | 41 | // Validator for a time value with only hours and minutes (no seconds) |
41 | // Mostly locale aware. Author: David Faure <faure@kde.org> | 42 | // Mostly locale aware. Author: David Faure <faure@kde.org> |
42 | class KOTimeValidator : public QValidator | ||
43 | { | ||
44 | public: | ||
45 | KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {} | ||
46 | |||
47 | virtual State validate(QString& str, int& /*cursorPos*/) const | ||
48 | { | ||
49 | return Acceptable; | ||
50 | bool ok = false; | ||
51 | // TODO use KLocale::WithoutSeconds in HEAD | ||
52 | /*QTime time =*/ KGlobal::locale()->readTime(str, &ok); | ||
53 | if ( ok ) | ||
54 | return Acceptable; | ||
55 | // readTime doesn't help knowing when the string is "Intermediate". | ||
56 | int length = str.length(); | ||
57 | if ( !str ) // empty string? | ||
58 | return Invalid; // there should always be a ':' in it, right? | ||
59 | // HACK. Not fully locale aware etc. (esp. the separator is '.' in sv_SE...) | ||
60 | QChar sep = ':'; | ||
61 | // I want to allow "HH:", ":MM" and ":" to make editing easier | ||
62 | if ( str[0] == sep ) | ||
63 | { | ||
64 | if ( length == 1 ) // just ":" | ||
65 | return Intermediate; | ||
66 | QString minutes = str.mid(1); | ||
67 | int m = minutes.toInt(&ok); | ||
68 | if ( ok && m >= 0 && m < 60 ) | ||
69 | return Intermediate; | ||
70 | } else if ( str.at(str.length()-1) == sep ) | ||
71 | { | ||
72 | QString hours = str.left(length-1); | ||
73 | int h = hours.toInt(&ok); | ||
74 | if ( ok && h >= 0 && h < 24 ) | ||
75 | return Intermediate; | ||
76 | } | ||
77 | return Invalid; | ||
78 | } | ||
79 | }; | ||
80 | 43 | ||
81 | // KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. | 44 | // KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. |
82 | // Difficult to get all in one... | 45 | // Difficult to get all in one... |
83 | // But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. | 46 | // But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. |
84 | KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) | 47 | KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) |
85 | : QComboBox(TRUE, parent, name) | 48 | : QComboBox(TRUE, parent, name) |
86 | { | 49 | { |
87 | setInsertionPolicy(NoInsertion); | 50 | setInsertionPolicy(NoInsertion); |
88 | setValidator( new KOTimeValidator( this ) ); | ||
89 | mFlagKeyPressed = false; | 51 | mFlagKeyPressed = false; |
90 | 52 | ||
91 | if ( QApplication::desktop()->width() < 650 ) | 53 | if ( QApplication::desktop()->width() < 650 ) |
92 | setSizeLimit ( 6 ); | 54 | setSizeLimit ( 6 ); |
93 | mTime = qt; | 55 | mTime = qt; |
94 | 56 | ||
95 | // mNoTimeString = i18n("No Time"); | 57 | // mNoTimeString = i18n("No Time"); |
96 | // insertItem( mNoTimeString ); | 58 | // insertItem( mNoTimeString ); |
97 | 59 | ||
98 | // Fill combo box with selection of times in localized format. | 60 | // Fill combo box with selection of times in localized format. |
99 | QTime timeEntry(0,0,0); | 61 | QTime timeEntry(0,0,0); |
100 | do { | 62 | do { |
101 | insertItem(KGlobal::locale()->formatTime(timeEntry)); | 63 | insertItem(KGlobal::locale()->formatTime(timeEntry)); |
102 | timeEntry = timeEntry.addSecs(60*15); | 64 | timeEntry = timeEntry.addSecs(60*15); |
103 | } while (!timeEntry.isNull()); | 65 | } while (!timeEntry.isNull()); |
104 | // Add end of day. | 66 | // Add end of day. |
105 | insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); | 67 | insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); |
106 | 68 | ||
107 | updateText(); | 69 | updateText(); |
108 | setFocusPolicy(QWidget::StrongFocus); | 70 | setFocusPolicy(QWidget::StrongFocus); |
109 | 71 | ||
110 | connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); | 72 | connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); |
111 | connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); | 73 | connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); |
112 | connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); | 74 | connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); |
113 | QFontMetrics fm ( font() ); | 75 | QFontMetrics fm ( font() ); |
114 | QString timeString = "24:00"; | 76 | QString timeString = "24:00"; |
115 | if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ) | 77 | if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ) |
116 | timeString = "02:00pm"; | 78 | timeString = "02:00pm"; |
117 | int addSpace = 32; | 79 | int addSpace = 32; |
118 | if ( QApplication::desktop()->width() > 320 ) | 80 | if ( QApplication::desktop()->width() > 320 ) |
119 | timeString += ":00"; | 81 | timeString += ":00"; |
120 | setFixedWidth(fm.width( timeString ) + 32 ); | 82 | setFixedWidth(fm.width( timeString ) + 32 ); |
121 | 83 | ||
122 | // Highlight Background and Textcolor change from default | 84 | // Highlight Background and Textcolor change from default |
123 | QPalette palette = QWidget::palette(); | 85 | QPalette palette = QWidget::palette(); |
124 | unsigned char red, green, blue; | 86 | unsigned char red, green, blue; |
125 | red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; | 87 | red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; |
126 | green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; | 88 | green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; |
127 | blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; | 89 | blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; |
128 | palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); | 90 | palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); |
129 | palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); | 91 | palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); |
130 | setPalette( palette ); | 92 | setPalette( palette ); |
131 | } | 93 | } |
132 | 94 | ||
133 | KOTimeEdit::~KOTimeEdit() | 95 | KOTimeEdit::~KOTimeEdit() |
134 | { | 96 | { |
135 | } | 97 | } |
136 | 98 | ||
137 | bool KOTimeEdit::hasTime() const | 99 | bool KOTimeEdit::hasTime() const |
138 | { | 100 | { |
139 | // Can't happen | 101 | // Can't happen |
140 | if ( currentText().isEmpty() ) return false; | 102 | if ( currentText().isEmpty() ) return false; |
141 | //if ( currentText() == mNoTimeString ) return false; | 103 | //if ( currentText() == mNoTimeString ) return false; |
142 | 104 | ||
143 | return true; // always | 105 | return true; // always |
144 | } | 106 | } |
145 | 107 | ||
146 | QTime KOTimeEdit::getTime() const | 108 | QTime KOTimeEdit::getTime() const |
147 | { | 109 | { |
148 | //kdDebug(5850) << "KOTimeEdit::getTime(), currentText() = " << currentText() << endl; | 110 | return KGlobal::locale()->readTime(currentText()); |
149 | // TODO use KLocale::WithoutSeconds in HEAD | ||
150 | QTime time = KGlobal::locale()->readTime(currentText()); | ||
151 | // kdDebug(5850) << "KOTimeEdit::getTime(): " << time.toString() << endl; | ||
152 | return time; | ||
153 | } | 111 | } |
154 | /* | 112 | /* |
155 | QSizePolicy KOTimeEdit::sizePolicy() const | 113 | QSizePolicy KOTimeEdit::sizePolicy() const |
156 | { | 114 | { |
157 | // Set size policy to Fixed, because edit cannot contain more text than the | 115 | // Set size policy to Fixed, because edit cannot contain more text than the |
158 | // string representing the time. It doesn't make sense to provide more space. | 116 | // string representing the time. It doesn't make sense to provide more space. |
159 | QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); | 117 | QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); |
160 | 118 | ||
161 | return sizePolicy; | 119 | return sizePolicy; |
162 | } | 120 | } |
163 | */ | 121 | */ |
164 | void KOTimeEdit::setTime(QTime newTime) | 122 | void KOTimeEdit::setTime(QTime newTime) |
165 | { | 123 | { |
166 | if ( mTime != newTime ) | 124 | if ( mTime != newTime ) |
167 | { | 125 | { |
168 | kdDebug(5850) << "KOTimeEdit::setTime(): " << newTime.toString() << endl; | ||
169 | |||
170 | mTime = newTime; | 126 | mTime = newTime; |
171 | updateText(); | 127 | updateText(); |
172 | } | 128 | } |
173 | 129 | ||
174 | } | 130 | } |
175 | 131 | ||
176 | void KOTimeEdit::activ(int i) | 132 | void KOTimeEdit::activ(int i) |
177 | { | 133 | { |
178 | // The last entry, 23:59, is a special case | 134 | // The last entry, 23:59, is a special case |
179 | if( i == count() - 1 ) | 135 | if( i == count() - 1 ) |
180 | mTime = QTime( 23, 59, 0 ); | 136 | mTime = QTime( 23, 59, 0 ); |
181 | else | 137 | else |
182 | mTime = QTime(0,0,0).addSecs(i*15*60); | 138 | mTime = QTime(0,0,0).addSecs(i*15*60); |
183 | emit timeChanged(mTime); | 139 | emit timeChanged(mTime); |
184 | } | 140 | } |
185 | 141 | ||
186 | void KOTimeEdit::hilit(int ) | 142 | void KOTimeEdit::hilit(int ) |
187 | { | 143 | { |
188 | // we don't currently need to do anything here. | 144 | // we don't currently need to do anything here. |
189 | } | 145 | } |
190 | 146 | ||
191 | void KOTimeEdit::addTime(QTime qt, bool update) | 147 | void KOTimeEdit::addTime(QTime qt, bool update) |
192 | { | 148 | { |
193 | // Calculate the new time. | 149 | // Calculate the new time. |
194 | //qDebug("add h %d min %d ", qt.hour(),qt.minute() ); | 150 | //qDebug("add h %d min %d ", qt.hour(),qt.minute() ); |
195 | mTime = mTime.addSecs(qt.minute()*60+qt.hour()*3600); | 151 | mTime = mTime.addSecs(qt.minute()*60+qt.hour()*3600); |
196 | // if ( update ) | 152 | // if ( update ) |
197 | updateText(); | 153 | updateText(); |
198 | emit timeChanged(mTime); | 154 | emit timeChanged(mTime); |
199 | } | 155 | } |
200 | 156 | ||
201 | void KOTimeEdit::subTime(QTime qt, bool update) | 157 | void KOTimeEdit::subTime(QTime qt, bool update) |
202 | { | 158 | { |
203 | int h, m; | 159 | int h, m; |
204 | //qDebug("sub h %d min %d ", qt.hour(),qt.minute() ); | 160 | //qDebug("sub h %d min %d ", qt.hour(),qt.minute() ); |
205 | 161 | ||
206 | mTime = mTime.addSecs(-(qt.minute()*60+qt.hour()*3600)); | 162 | mTime = mTime.addSecs(-(qt.minute()*60+qt.hour()*3600)); |
207 | // store the newly calculated time. | 163 | // store the newly calculated time. |
208 | // mTime.setHMS(h, m, 0); | 164 | // mTime.setHMS(h, m, 0); |
209 | //if ( update ) | 165 | //if ( update ) |
210 | updateText(); | 166 | updateText(); |
211 | emit timeChanged(mTime); | 167 | emit timeChanged(mTime); |
212 | } | 168 | } |
213 | 169 | ||
214 | // void KOTimeEdit::mouseReleaseEvent ( QMouseEvent * ) | 170 | // void KOTimeEdit::mouseReleaseEvent ( QMouseEvent * ) |
215 | // { | 171 | // { |
216 | // qDebug("mouseReleaseEvent ( QMouseEvent * ) "); | 172 | // qDebug("mouseReleaseEvent ( QMouseEvent * ) "); |
217 | // } | 173 | // } |
218 | 174 | ||
219 | // void KOTimeEdit::focusInEvent ( QFocusEvent * ) | 175 | // void KOTimeEdit::focusInEvent ( QFocusEvent * ) |
220 | // { | 176 | // { |
221 | // qDebug("focusInEvent ( QFocusEvent * ) "); | 177 | // qDebug("focusInEvent ( QFocusEvent * ) "); |
222 | // } | 178 | // } |
223 | 179 | ||
224 | void KOTimeEdit::keyReleaseEvent(QKeyEvent *e) | 180 | void KOTimeEdit::keyReleaseEvent(QKeyEvent *e) |
225 | { | 181 | { |
226 | if ( !e->isAutoRepeat() ) { | 182 | if ( !e->isAutoRepeat() ) { |
227 | mFlagKeyPressed = false; | 183 | mFlagKeyPressed = false; |
228 | } | 184 | } |
229 | 185 | ||
230 | } | 186 | } |
231 | void KOTimeEdit::setSelect( int from, int to ) | 187 | void KOTimeEdit::setSelect( int from, int to ) |
232 | { | 188 | { |
233 | if ( KOPrefs::instance()->mHightlightDateTimeEdit) | 189 | if ( KOPrefs::instance()->mHightlightDateTimeEdit) |
234 | lineEdit()->setSelection( from , to ); | 190 | lineEdit()->setSelection( from , to ); |
235 | } | 191 | } |
236 | 192 | ||
237 | 193 | ||
238 | void KOTimeEdit::keyPressEvent(QKeyEvent *e) | 194 | void KOTimeEdit::keyPressEvent(QKeyEvent *e) |
239 | { | 195 | { |
240 | 196 | ||
241 | qApp->processEvents(); | 197 | qApp->processEvents(); |
242 | bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ); | 198 | bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ); |
243 | int maxpos = hour12Format?7:5; | 199 | int maxpos = hour12Format?7:5; |
244 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 200 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
245 | e->ignore(); | 201 | e->ignore(); |
246 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 202 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
247 | return; | 203 | return; |
248 | } | 204 | } |
249 | if (! e->isAutoRepeat() ) { | 205 | if (! e->isAutoRepeat() ) { |
250 | mFlagKeyPressed = true; | 206 | mFlagKeyPressed = true; |
251 | } | 207 | } |
252 | // Tap -> Focus Next Widget | 208 | // Tap -> Focus Next Widget |
253 | if ( e->key() == Key_Tab ) { | 209 | if ( e->key() == Key_Tab ) { |
254 | QComboBox::keyPressEvent(e); | 210 | QComboBox::keyPressEvent(e); |
255 | return; | 211 | return; |
256 | } | 212 | } |
257 | 213 | ||
258 | // save Text from QLineEdit and CursorPosition | 214 | // save Text from QLineEdit and CursorPosition |
259 | QString text = lineEdit()->text(); | 215 | QString text = lineEdit()->text(); |
260 | int cpos = lineEdit()->cursorPosition(); | 216 | int cpos = lineEdit()->cursorPosition(); |
261 | // qDebug("cpos %d ", cpos); | 217 | // qDebug("cpos %d ", cpos); |
262 | 218 | ||
263 | // Switch for arrows, backspace and escape | 219 | // Switch for arrows, backspace and escape |
264 | switch(e->key()) { | 220 | switch(e->key()) { |
265 | case Key_Escape: | 221 | case Key_Escape: |
266 | lineEdit()->deselect(); | 222 | lineEdit()->deselect(); |
267 | case Key_Tab: | 223 | case Key_Tab: |
268 | QComboBox::keyPressEvent(e); | 224 | QComboBox::keyPressEvent(e); |
269 | break; | 225 | break; |
270 | case Key_Up: | 226 | case Key_Up: |
271 | if ( e->state () == Qt::ControlButton ) { | 227 | if ( e->state () == Qt::ControlButton ) { |
272 | addTime(QTime(0,15,0), false ); | 228 | addTime(QTime(0,15,0), false ); |
273 | lineEdit()->setCursorPosition(3); | 229 | lineEdit()->setCursorPosition(3); |
274 | setSelect( 3 , 2 ); | 230 | setSelect( 3 , 2 ); |
275 | } | 231 | } |
276 | else | 232 | else |
277 | if ( e->state () == Qt::ShiftButton ) { | 233 | if ( e->state () == Qt::ShiftButton ) { |
278 | addTime(QTime(1,0,0), false ); | 234 | addTime(QTime(1,0,0), false ); |
279 | lineEdit()->setCursorPosition(0); | 235 | lineEdit()->setCursorPosition(0); |
280 | setSelect( 0 , 2 ); | 236 | setSelect( 0 , 2 ); |
281 | } | 237 | } |
282 | else | 238 | else |
283 | // switch time up, cursor location depend | 239 | // switch time up, cursor location depend |
284 | switch (cpos) { | 240 | switch (cpos) { |
285 | case 7: | 241 | case 7: |
286 | case 6: | 242 | case 6: |
287 | case 5: | 243 | case 5: |
288 | if(!hour12Format) { | 244 | if(!hour12Format) { |
289 | lineEdit()->setCursorPosition(cpos = 4); | 245 | lineEdit()->setCursorPosition(cpos = 4); |
290 | } else { | 246 | } else { |
291 | addTime(QTime(12,0,0), false ); | 247 | addTime(QTime(12,0,0), false ); |
292 | setSelect ( 5 , 2 ); | 248 | setSelect ( 5 , 2 ); |
293 | break; | 249 | break; |
294 | } | 250 | } |
295 | case 4: | 251 | case 4: |
296 | addTime(QTime(0,1,0), false ); | 252 | addTime(QTime(0,1,0), false ); |
297 | setSelect ( cpos , 1 ); | 253 | setSelect ( cpos , 1 ); |
298 | break; | 254 | break; |
299 | case 3: | 255 | case 3: |
300 | addTime(QTime(0,10,0), false ); | 256 | addTime(QTime(0,10,0), false ); |
301 | setSelect ( cpos , 1 ); | 257 | setSelect ( cpos , 1 ); |
302 | break; | 258 | break; |
303 | case 2: | 259 | case 2: |
304 | lineEdit()->setCursorPosition(--cpos); | 260 | lineEdit()->setCursorPosition(--cpos); |
305 | case 1: | 261 | case 1: |
306 | case 0: | 262 | case 0: |
307 | addTime(QTime(1,0,0), false ); | 263 | addTime(QTime(1,0,0), false ); |
308 | setSelect ( 0, 2 ); | 264 | setSelect ( 0, 2 ); |
309 | break; | 265 | break; |
310 | } | 266 | } |
311 | break; | 267 | break; |
312 | case Key_Down: | 268 | case Key_Down: |
313 | if ( e->state () == Qt::ControlButton ) { | 269 | if ( e->state () == Qt::ControlButton ) { |
314 | subTime(QTime(0,15,0), false ); | 270 | subTime(QTime(0,15,0), false ); |
315 | lineEdit()->setCursorPosition(3); | 271 | lineEdit()->setCursorPosition(3); |
316 | setSelect( 3 , 2 ); | 272 | setSelect( 3 , 2 ); |
317 | } | 273 | } |
318 | else | 274 | else |
319 | if ( e->state () == Qt::ShiftButton ) { | 275 | if ( e->state () == Qt::ShiftButton ) { |
320 | subTime(QTime(1,0,0), false ); | 276 | subTime(QTime(1,0,0), false ); |
321 | lineEdit()->setCursorPosition(0); | 277 | lineEdit()->setCursorPosition(0); |
322 | setSelect( 0 , 2 ); | 278 | setSelect( 0 , 2 ); |
323 | } | 279 | } |
324 | else | 280 | else |
325 | // switch time down, cursor location depend | 281 | // switch time down, cursor location depend |
326 | switch (cpos) { | 282 | switch (cpos) { |
327 | case 7: | 283 | case 7: |
328 | case 6: | 284 | case 6: |
329 | case 5: | 285 | case 5: |
330 | if(!hour12Format) { | 286 | if(!hour12Format) { |
331 | lineEdit()->setCursorPosition(cpos = 4); | 287 | lineEdit()->setCursorPosition(cpos = 4); |
332 | } else { | 288 | } else { |
333 | subTime(QTime(12,0,0), false ); | 289 | subTime(QTime(12,0,0), false ); |
334 | setSelect ( 5 , 2 ); | 290 | setSelect ( 5 , 2 ); |
335 | break; | 291 | break; |
336 | } | 292 | } |
337 | case 4: | 293 | case 4: |
338 | subTime(QTime(0,1,0), false ); | 294 | subTime(QTime(0,1,0), false ); |
339 | setSelect ( cpos , 1 ); | 295 | setSelect ( cpos , 1 ); |
340 | break; | 296 | break; |
341 | case 3: | 297 | case 3: |
342 | subTime(QTime(0,10,0), false ); | 298 | subTime(QTime(0,10,0), false ); |
343 | setSelect ( cpos , 1 ); | 299 | setSelect ( cpos , 1 ); |
344 | break; | 300 | break; |
345 | case 2: | 301 | case 2: |
346 | lineEdit()->setCursorPosition(--cpos); | 302 | lineEdit()->setCursorPosition(--cpos); |
347 | case 1: | 303 | case 1: |
348 | case 0: | 304 | case 0: |
349 | subTime(QTime(1,0,0), false ); | 305 | subTime(QTime(1,0,0), false ); |
350 | setSelect ( 0 , 2 ); | 306 | setSelect ( 0 , 2 ); |
351 | break; | 307 | break; |
352 | } | 308 | } |
353 | break; | 309 | break; |
354 | // set cursor to correct place | 310 | // set cursor to correct place |
355 | case Key_Left: | 311 | case Key_Left: |
356 | if ( cpos == 3 ) | 312 | if ( cpos == 3 ) |
357 | --cpos; | 313 | --cpos; |
358 | if ( cpos > 0) { | 314 | if ( cpos > 0) { |
359 | lineEdit()->setCursorPosition(--cpos); | 315 | lineEdit()->setCursorPosition(--cpos); |
360 | setSelect ( cpos , 1 ); | 316 | setSelect ( cpos , 1 ); |
361 | } | 317 | } |
362 | else | 318 | else |
363 | setSelect ( 0 , 1 ); | 319 | setSelect ( 0 , 1 ); |
364 | break; | 320 | break; |
365 | // set cursor to correct place | 321 | // set cursor to correct place |
366 | case Key_Right: | 322 | case Key_Right: |
367 | if ( cpos == 1 ) | 323 | if ( cpos == 1 ) |
368 | ++cpos; | 324 | ++cpos; |
369 | if ( cpos < maxpos ) { | 325 | if ( cpos < maxpos ) { |
370 | lineEdit()->setCursorPosition(++cpos); | 326 | lineEdit()->setCursorPosition(++cpos); |
371 | setSelect ( cpos , 1 ); | 327 | setSelect ( cpos , 1 ); |
372 | } | 328 | } |
373 | break; | 329 | break; |
374 | // rest | 330 | // rest |
375 | case Key_Prior: | 331 | case Key_Prior: |
376 | subTime(QTime(1,0,0)); | 332 | subTime(QTime(1,0,0)); |
377 | break; | 333 | break; |
378 | case Key_Next: | 334 | case Key_Next: |
379 | addTime(QTime(1,0,0)); | 335 | addTime(QTime(1,0,0)); |
380 | break; | 336 | break; |
381 | case Key_Backspace: | 337 | case Key_Backspace: |
338 | qDebug("+++++++++++back "); | ||
382 | if ( cpos > 0) { | 339 | if ( cpos > 0) { |
383 | if ( cpos == 3 ) | 340 | if ( cpos == 3 ) |
384 | --cpos; | 341 | --cpos; |
385 | if ( cpos > 5) | 342 | if ( cpos > 5) |
386 | cpos = 5; | 343 | cpos = 5; |
387 | text.at( cpos-1 ) = '0'; | 344 | text.at( cpos-1 ) = '0'; |
388 | lineEdit()->setText( text ); | 345 | lineEdit()->setText( text ); |
389 | lineEdit()->setCursorPosition(--cpos); | 346 | lineEdit()->setCursorPosition(--cpos); |
390 | setSelect ( cpos , 1 ); | 347 | setSelect ( cpos , 1 ); |
391 | changedText(); | 348 | changedText(); |
349 | qDebug("---------back "); | ||
392 | } | 350 | } |
393 | break; | 351 | break; |
394 | } // switch arrows | 352 | } // switch arrows |
395 | 353 | ||
396 | // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos | 354 | // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos |
397 | if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { | 355 | if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { |
398 | lineEdit()->deselect(); | 356 | lineEdit()->deselect(); |
399 | cpos = 0; | 357 | cpos = 0; |
400 | lineEdit()->setCursorPosition(cpos); | 358 | lineEdit()->setCursorPosition(cpos); |
401 | setSelect(cpos , 1); | 359 | setSelect(cpos , 1); |
402 | } | 360 | } |
403 | 361 | ||
404 | if ( cpos == 2 ) { | 362 | if ( cpos == 2 ) { |
405 | lineEdit()->setCursorPosition(++cpos); | 363 | lineEdit()->setCursorPosition(++cpos); |
406 | } | 364 | } |
407 | 365 | ||
408 | // num keys when cursorPos preEnd | 366 | // num keys when cursorPos preEnd |
409 | if ( cpos < 5 ) { | 367 | if ( cpos < 5 ) { |
410 | // switch another keys | 368 | // switch another keys |
411 | switch(e->key()) { | 369 | switch(e->key()) { |
412 | case Key_Delete: | 370 | case Key_Delete: |
413 | text.at( cpos ) = '0'; | 371 | text.at( cpos ) = '0'; |
414 | lineEdit()->setText( text ); | 372 | lineEdit()->setText( text ); |
415 | lineEdit()->setCursorPosition(cpos); | 373 | lineEdit()->setCursorPosition(cpos); |
416 | setSelect ( cpos , 1 ); | 374 | setSelect ( cpos , 1 ); |
417 | changedText(); | 375 | changedText(); |
418 | break; | 376 | break; |
419 | case Key_9: | 377 | case Key_9: |
420 | case Key_8: | 378 | case Key_8: |
421 | case Key_7: | 379 | case Key_7: |
422 | case Key_6: | 380 | case Key_6: |
423 | if ( !(cpos == 1 || cpos == 4) ) | 381 | if ( !(cpos == 1 || cpos == 4) ) |
424 | return; | 382 | return; |
425 | if ( cpos == 1 && text.at( 0 ) > '1') | 383 | if ( cpos == 1 && text.at( 0 ) > '1') |
426 | text.at( 0 ) = '1'; | 384 | text.at( 0 ) = '1'; |
427 | case Key_5: | 385 | case Key_5: |
428 | case Key_4: | 386 | case Key_4: |
429 | case Key_3: | 387 | case Key_3: |
430 | if ( cpos < 1 ) | 388 | if ( cpos < 1 ) |
431 | return; | 389 | return; |
432 | if ( hour12Format && cpos == 1 ) | 390 | if ( hour12Format && cpos == 1 ) |
433 | return; | 391 | return; |
434 | case Key_2: | 392 | case Key_2: |
435 | if ( hour12Format && cpos == 0 ) | 393 | if ( hour12Format && cpos == 0 ) |
436 | return; | 394 | return; |
437 | if ( cpos == 0 && text.at( 1 ) > '3') | 395 | if ( cpos == 0 && text.at( 1 ) > '3') |
438 | text.at( 1 ) = '3'; | 396 | text.at( 1 ) = '3'; |
439 | case Key_1: | 397 | case Key_1: |
440 | case Key_0: | 398 | case Key_0: |
441 | if ( hour12Format ) { | 399 | if ( hour12Format ) { |
442 | if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' ) | 400 | if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' ) |
443 | return; | 401 | return; |
444 | if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' ) | 402 | if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' ) |
445 | text.at( 1 ) = '1'; | 403 | text.at( 1 ) = '1'; |
446 | } | 404 | } |
447 | text.at( cpos ) = QChar ( e->key() ); | 405 | text.at( cpos ) = QChar ( e->key() ); |
448 | lineEdit()->setText( text ); | 406 | lineEdit()->setText( text ); |
449 | if ( cpos == 1 ) | 407 | if ( cpos == 1 ) |
450 | ++cpos; | 408 | ++cpos; |
451 | if ( cpos < 5) | 409 | if ( cpos < 5) |
452 | lineEdit()->setCursorPosition(++cpos); | 410 | lineEdit()->setCursorPosition(++cpos); |
453 | setSelect( cpos , 1 ); | 411 | setSelect( cpos , 1 ); |
454 | changedText(); | 412 | changedText(); |
455 | break; | 413 | break; |
456 | case Key_Home: | 414 | case Key_Home: |
457 | lineEdit()->setCursorPosition(0); | 415 | lineEdit()->setCursorPosition(0); |
458 | setSelect( cpos , 1 ); | 416 | setSelect( cpos , 1 ); |
459 | break; | 417 | break; |
460 | case Key_End: | 418 | case Key_End: |
461 | lineEdit()->setCursorPosition(5); | 419 | lineEdit()->setCursorPosition(5); |
462 | lineEdit()->deselect(); | 420 | lineEdit()->deselect(); |
463 | break; | 421 | break; |
464 | default: | 422 | default: |
465 | // QComboBox::keyPressEvent(e); | 423 | // QComboBox::keyPressEvent(e); |
466 | break; | 424 | break; |
467 | } // switch num keys | 425 | } // switch num keys |
468 | } else if ( cpos == 5 ) {// if cpos < 5 | 426 | } else if ( cpos == 5 ) {// if cpos < 5 |
469 | if ( hour12Format ) { | 427 | if ( hour12Format ) { |
470 | if ( e->key() == Key_A ) { | 428 | if ( e->key() == Key_A ) { |
471 | text.at( 5 ) = 'a'; | 429 | text.at( 5 ) = 'a'; |
472 | lineEdit()->setText( text ); | 430 | lineEdit()->setText( text ); |
473 | lineEdit()->setCursorPosition(5); | 431 | lineEdit()->setCursorPosition(5); |
474 | 432 | ||
475 | } else if ( e->key() == Key_P ) { | 433 | } else if ( e->key() == Key_P ) { |
476 | text.at( 5 ) = 'p'; | 434 | text.at( 5 ) = 'p'; |
477 | lineEdit()->setText( text ); | 435 | lineEdit()->setText( text ); |
478 | lineEdit()->setCursorPosition(5); | 436 | lineEdit()->setCursorPosition(5); |
479 | 437 | ||
480 | } | 438 | } |
481 | } | 439 | } |
482 | } | 440 | } |
483 | 441 | ||
484 | 442 | ||
485 | } | 443 | } |
486 | 444 | ||
487 | void KOTimeEdit::updateText() | 445 | void KOTimeEdit::updateText() |
488 | { | 446 | { |
489 | // kdDebug(5850) << "KOTimeEdit::updateText() " << endl | 447 | listBox()->blockSignals( true ); |
490 | QString s = KGlobal::locale()->formatTime(mTime); | 448 | blockSignals( true ); |
491 | // Set the text but without emitting signals, nor losing the cursor position | 449 | QString s = KGlobal::locale()->formatTime(mTime); |
492 | QLineEdit *line = lineEdit(); | 450 | // Set the text but without emitting signals, nor losing the cursor position |
493 | line->blockSignals(true); | 451 | QLineEdit *line = lineEdit(); |
494 | int pos = line->cursorPosition(); | 452 | line->blockSignals(true); |
495 | // qDebug(" settext *%s* ", s.latin1()); | 453 | int pos = line->cursorPosition(); |
496 | line->setText(s); | ||
497 | // line->setCursorPosition(pos); | ||
498 | // line->blockSignals(false); | ||
499 | |||
500 | // kdDebug(5850) << "KOTimeEdit::updateText(): " << s << endl; | ||
501 | |||
502 | if (!mTime.minute() % 15) { | ||
503 | setCurrentItem((mTime.hour()*4)+(mTime.minute()/15)); | 454 | setCurrentItem((mTime.hour()*4)+(mTime.minute()/15)); |
504 | } | 455 | line->setText(s); |
505 | line->setCursorPosition(pos); | 456 | line->setCursorPosition(pos); |
506 | line->blockSignals(false); | 457 | line->blockSignals(false); |
507 | 458 | blockSignals( false ); | |
508 | } | 459 | listBox()->blockSignals( false ); |
509 | 460 | ||
510 | bool KOTimeEdit::inputIsValid() const | ||
511 | { | ||
512 | int cursorPos = lineEdit()->cursorPosition(); | ||
513 | QString str = currentText(); | ||
514 | return validator()->validate( str, cursorPos ) == QValidator::Acceptable; | ||
515 | } | 461 | } |
516 | 462 | ||
517 | void KOTimeEdit::changedText() | 463 | void KOTimeEdit::changedText() |
518 | { | 464 | { |
519 | //kdDebug(5850) << "KOTimeEdit::changedText()" << endl; | 465 | int pos = lineEdit()->cursorPosition(); |
520 | if ( inputIsValid() ) | 466 | mTime = getTime(); |
521 | { | 467 | blockSignals( true ); |
522 | int pos = lineEdit()->cursorPosition(); | 468 | QString text = lineEdit()->text(); |
523 | mTime = getTime(); | 469 | setCurrentItem((mTime.hour()*4)+(mTime.minute()/15)); |
524 | // updateText(); | 470 | lineEdit()->setText(text); |
525 | emit timeChanged(mTime); | 471 | blockSignals( false ); |
526 | lineEdit()->setCursorPosition(pos); | 472 | emit timeChanged(mTime); |
527 | } | 473 | lineEdit()->setCursorPosition(pos); |
528 | } | 474 | } |
diff --git a/korganizer/ktimeedit.h b/korganizer/ktimeedit.h index 7923070..b3d842d 100644 --- a/korganizer/ktimeedit.h +++ b/korganizer/ktimeedit.h | |||
@@ -1,97 +1,94 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown, Ian Dawes | 3 | Copyright (c) 1999 Preston Brown, Ian Dawes |
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 _KTIMEEDIT_H | 23 | #ifndef _KTIMEEDIT_H |
24 | #define _KTIMEEDIT_H | 24 | #define _KTIMEEDIT_H |
25 | 25 | ||
26 | #include <qevent.h> | 26 | #include <qevent.h> |
27 | #include <qkeycode.h> | 27 | #include <qkeycode.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | 31 | ||
32 | #include <kapplication.h> | 32 | #include <kapplication.h> |
33 | 33 | ||
34 | /** | 34 | /** |
35 | This is a class that provides an easy, user friendly way to edit times. | 35 | This is a class that provides an easy, user friendly way to edit times. |
36 | up/down/ increase or decrease time, respectively. | 36 | up/down/ increase or decrease time, respectively. |
37 | 37 | ||
38 | @short Provides a way to edit times in a user-friendly manner. | 38 | @short Provides a way to edit times in a user-friendly manner. |
39 | @author Preston Brown, Ian Dawes | 39 | @author Preston Brown, Ian Dawes |
40 | */ | 40 | */ |
41 | class KOTimeEdit : public QComboBox | 41 | class KOTimeEdit : public QComboBox |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | /** constructs a new time edit. */ | 45 | /** constructs a new time edit. */ |
46 | KOTimeEdit(QWidget *parent=0, QTime qt=QTime(12,0), const char *name=0); | 46 | KOTimeEdit(QWidget *parent=0, QTime qt=QTime(12,0), const char *name=0); |
47 | 47 | ||
48 | virtual ~KOTimeEdit(); | 48 | virtual ~KOTimeEdit(); |
49 | 49 | ||
50 | /** | 50 | /** |
51 | Returns, if a time is selected. Can not return false anymore.... | 51 | Returns, if a time is selected. Can not return false anymore.... |
52 | */ | 52 | */ |
53 | bool hasTime() const; | 53 | bool hasTime() const; |
54 | 54 | ||
55 | /** returns the time that is currently set in the timeLineEdit. */ | 55 | /** returns the time that is currently set in the timeLineEdit. */ |
56 | QTime getTime() const; | 56 | QTime getTime() const; |
57 | 57 | ||
58 | /** returns the prefered size policy of the KOTimeEdit */ | 58 | /** returns the prefered size policy of the KOTimeEdit */ |
59 | //QSizePolicy sizePolicy() const; | 59 | //QSizePolicy sizePolicy() const; |
60 | 60 | ||
61 | /** return true if input is a valid time and false if not */ | ||
62 | bool inputIsValid() const; | ||
63 | |||
64 | signals: | 61 | signals: |
65 | /** | 62 | /** |
66 | Emitted every time the time displayed changes. "newt" is the new | 63 | Emitted every time the time displayed changes. "newt" is the new |
67 | time. | 64 | time. |
68 | */ | 65 | */ |
69 | void timeChanged(QTime newt); | 66 | void timeChanged(QTime newt); |
70 | 67 | ||
71 | public slots: | 68 | public slots: |
72 | /** used to set the time which is displayed to a specific value. */ | 69 | /** used to set the time which is displayed to a specific value. */ |
73 | void setTime(QTime qt); | 70 | void setTime(QTime qt); |
74 | 71 | ||
75 | protected slots: | 72 | protected slots: |
76 | void activ(int); | 73 | void activ(int); |
77 | void hilit(int); | 74 | void hilit(int); |
78 | void changedText(); | 75 | void changedText(); |
79 | 76 | ||
80 | protected: | 77 | protected: |
81 | void keyPressEvent(QKeyEvent *qke); | 78 | void keyPressEvent(QKeyEvent *qke); |
82 | void keyReleaseEvent(QKeyEvent *qke); | 79 | void keyReleaseEvent(QKeyEvent *qke); |
83 | void setSelect ( int, int ); | 80 | void setSelect ( int, int ); |
84 | bool mFlagKeyPressed; | 81 | bool mFlagKeyPressed; |
85 | void addTime(QTime qt, bool update = true ); | 82 | void addTime(QTime qt, bool update = true ); |
86 | void subTime(QTime qt, bool update = true ); | 83 | void subTime(QTime qt, bool update = true ); |
87 | // Update the lineedit text from mTime | 84 | // Update the lineedit text from mTime |
88 | void updateText(); | 85 | void updateText(); |
89 | // void mouseReleaseEvent ( QMouseEvent * ) ; | 86 | // void mouseReleaseEvent ( QMouseEvent * ) ; |
90 | //void focusInEvent ( QFocusEvent * ) ; | 87 | //void focusInEvent ( QFocusEvent * ) ; |
91 | 88 | ||
92 | private: | 89 | private: |
93 | QTime mTime; // the widget's displayed time. | 90 | QTime mTime; // the widget's displayed time. |
94 | //QString mNoTimeString; | 91 | //QString mNoTimeString; |
95 | }; | 92 | }; |
96 | 93 | ||
97 | #endif | 94 | #endif |
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index d7e384c..7f31ab1 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp | |||
@@ -1,1085 +1,1085 @@ | |||
1 | #include <qregexp.h> | 1 | #include <qregexp.h> |
2 | #include <qapplication.h> | 2 | #include <qapplication.h> |
3 | 3 | ||
4 | #include "kdebug.h" | 4 | #include "kdebug.h" |
5 | #include "kcalendarsystemgregorian.h" | 5 | #include "kcalendarsystemgregorian.h" |
6 | 6 | ||
7 | #include "klocale.h" | 7 | #include "klocale.h" |
8 | 8 | ||
9 | #include <qstringlist.h> | 9 | #include <qstringlist.h> |
10 | 10 | ||
11 | //#define COLLECT_TRANSLATION | 11 | //#define COLLECT_TRANSLATION |
12 | 12 | ||
13 | 13 | ||
14 | QDict<QString> *mLocaleDict = 0; | 14 | QDict<QString> *mLocaleDict = 0; |
15 | void setLocaleDict( QDict<QString> * dict ) | 15 | void setLocaleDict( QDict<QString> * dict ) |
16 | { | 16 | { |
17 | mLocaleDict = dict; | 17 | mLocaleDict = dict; |
18 | 18 | ||
19 | } | 19 | } |
20 | 20 | ||
21 | #ifdef COLLECT_TRANSLATION | 21 | #ifdef COLLECT_TRANSLATION |
22 | 22 | ||
23 | QStringList missingTrans; | 23 | QStringList missingTrans; |
24 | QStringList existingTrans1; | 24 | QStringList existingTrans1; |
25 | QStringList existingTrans2; | 25 | QStringList existingTrans2; |
26 | 26 | ||
27 | void addMissing(const char *text) | 27 | void addMissing(const char *text) |
28 | { | 28 | { |
29 | 29 | ||
30 | QString mis ( text ); | 30 | QString mis ( text ); |
31 | if ( !missingTrans.contains( mis ) ) | 31 | if ( !missingTrans.contains( mis ) ) |
32 | missingTrans.append(mis); | 32 | missingTrans.append(mis); |
33 | 33 | ||
34 | } | 34 | } |
35 | void addExist(const char *text,QString trans ) | 35 | void addExist(const char *text,QString trans ) |
36 | { | 36 | { |
37 | //return; | 37 | //return; |
38 | QString mis ( text ); | 38 | QString mis ( text ); |
39 | if ( !existingTrans1.contains( mis ) ) { | 39 | if ( !existingTrans1.contains( mis ) ) { |
40 | existingTrans1.append(mis); | 40 | existingTrans1.append(mis); |
41 | existingTrans2.append(trans); | 41 | existingTrans2.append(trans); |
42 | 42 | ||
43 | } | 43 | } |
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qtextstream.h> | 48 | #include <qtextstream.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #endif | 50 | #endif |
51 | void dumpMissing() | 51 | void dumpMissing() |
52 | { | 52 | { |
53 | #ifdef COLLECT_TRANSLATION | 53 | #ifdef COLLECT_TRANSLATION |
54 | QString fileName = "/tmp/usernewtrans.txt"; | 54 | QString fileName = "/tmp/usernewtrans.txt"; |
55 | QFile file( fileName ); | 55 | QFile file( fileName ); |
56 | if (!file.open( IO_WriteOnly ) ) { | 56 | if (!file.open( IO_WriteOnly ) ) { |
57 | return ; | 57 | return ; |
58 | } | 58 | } |
59 | QTextStream ts( &file ); | 59 | QTextStream ts( &file ); |
60 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 60 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
61 | 61 | ||
62 | int i; | 62 | int i; |
63 | for ( i = 0; i< missingTrans.count(); ++i ) { | 63 | for ( i = 0; i< missingTrans.count(); ++i ) { |
64 | 64 | ||
65 | QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); | 65 | QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); |
66 | ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; | 66 | ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; |
67 | 67 | ||
68 | } | 68 | } |
69 | file.close(); | 69 | file.close(); |
70 | { | 70 | { |
71 | QString fileName = "/tmp/usertrans.txt"; | 71 | QString fileName = "/tmp/usertrans.txt"; |
72 | QFile file( fileName ); | 72 | QFile file( fileName ); |
73 | if (!file.open( IO_WriteOnly ) ) { | 73 | if (!file.open( IO_WriteOnly ) ) { |
74 | return ; | 74 | return ; |
75 | } | 75 | } |
76 | QTextStream ts( &file ); | 76 | QTextStream ts( &file ); |
77 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 77 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
78 | 78 | ||
79 | int i; | 79 | int i; |
80 | for ( i = 0; i< existingTrans1.count(); ++i ) { | 80 | for ( i = 0; i< existingTrans1.count(); ++i ) { |
81 | 81 | ||
82 | QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" ); | 82 | QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" ); |
83 | QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" ); | 83 | QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" ); |
84 | ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n"; | 84 | ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n"; |
85 | 85 | ||
86 | } | 86 | } |
87 | file.close(); | 87 | file.close(); |
88 | } | 88 | } |
89 | #endif | 89 | #endif |
90 | } | 90 | } |
91 | QString i18n(const char *text) | 91 | QString i18n(const char *text) |
92 | { | 92 | { |
93 | if ( ! mLocaleDict ) { | 93 | if ( ! mLocaleDict ) { |
94 | #ifdef COLLECT_TRANSLATION | 94 | #ifdef COLLECT_TRANSLATION |
95 | addMissing( text ); | 95 | addMissing( text ); |
96 | #endif | 96 | #endif |
97 | return QString( text ); | 97 | return QString( text ); |
98 | } | 98 | } |
99 | else { | 99 | else { |
100 | QString* ret = mLocaleDict->find(QString(text)) ; | 100 | QString* ret = mLocaleDict->find(QString(text)) ; |
101 | if ( ret == 0 ) { | 101 | if ( ret == 0 ) { |
102 | #ifdef COLLECT_TRANSLATION | 102 | #ifdef COLLECT_TRANSLATION |
103 | addMissing( text ); | 103 | addMissing( text ); |
104 | #endif | 104 | #endif |
105 | return QString( text ); | 105 | return QString( text ); |
106 | } | 106 | } |
107 | else { | 107 | else { |
108 | if ( (*ret).isEmpty() ) { | 108 | if ( (*ret).isEmpty() ) { |
109 | #ifdef COLLECT_TRANSLATION | 109 | #ifdef COLLECT_TRANSLATION |
110 | addMissing( text ); | 110 | addMissing( text ); |
111 | #endif | 111 | #endif |
112 | return QString( text ); | 112 | return QString( text ); |
113 | } | 113 | } |
114 | else { | 114 | else { |
115 | #ifdef COLLECT_TRANSLATION | 115 | #ifdef COLLECT_TRANSLATION |
116 | addExist( text, *ret ); | 116 | addExist( text, *ret ); |
117 | #endif | 117 | #endif |
118 | return (*ret); | 118 | return (*ret); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | } | 123 | } |
124 | 124 | ||
125 | QString i18n(const char *,const char *text) | 125 | QString i18n(const char *,const char *text) |
126 | { | 126 | { |
127 | return i18n( text ); | 127 | return i18n( text ); |
128 | } | 128 | } |
129 | 129 | ||
130 | QString i18n(const char *text1, const char *textn, int num) | 130 | QString i18n(const char *text1, const char *textn, int num) |
131 | { | 131 | { |
132 | if ( num == 1 ) return i18n( text1 ); | 132 | if ( num == 1 ) return i18n( text1 ); |
133 | else { | 133 | else { |
134 | QString text = i18n( textn ); | 134 | QString text = i18n( textn ); |
135 | int pos = text.find( "%n" ); | 135 | int pos = text.find( "%n" ); |
136 | if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) ); | 136 | if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) ); |
137 | return text; | 137 | return text; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | inline void put_it_in( QChar *buffer, uint& index, const QString &s ) | 141 | inline void put_it_in( QChar *buffer, uint& index, const QString &s ) |
142 | { | 142 | { |
143 | for ( uint l = 0; l < s.length(); l++ ) | 143 | for ( uint l = 0; l < s.length(); l++ ) |
144 | buffer[index++] = s.at( l ); | 144 | buffer[index++] = s.at( l ); |
145 | } | 145 | } |
146 | 146 | ||
147 | inline void put_it_in( QChar *buffer, uint& index, int number ) | 147 | inline void put_it_in( QChar *buffer, uint& index, int number ) |
148 | { | 148 | { |
149 | buffer[index++] = number / 10 + '0'; | 149 | buffer[index++] = number / 10 + '0'; |
150 | buffer[index++] = number % 10 + '0'; | 150 | buffer[index++] = number % 10 + '0'; |
151 | } | 151 | } |
152 | 152 | ||
153 | static int readInt(const QString &str, uint &pos) | 153 | static int readInt(const QString &str, uint &pos) |
154 | { | 154 | { |
155 | if (!str.at(pos).isDigit()) return -1; | 155 | if (!str.at(pos).isDigit()) return -1; |
156 | int result = 0; | 156 | int result = 0; |
157 | for (; str.length() > pos && str.at(pos).isDigit(); pos++) | 157 | for (; str.length() > pos && str.at(pos).isDigit(); pos++) |
158 | { | 158 | { |
159 | result *= 10; | 159 | result *= 10; |
160 | result += str.at(pos).digitValue(); | 160 | result += str.at(pos).digitValue(); |
161 | } | 161 | } |
162 | 162 | ||
163 | return result; | 163 | return result; |
164 | } | 164 | } |
165 | 165 | ||
166 | KLocale::KLocale() : mCalendarSystem( 0 ) | 166 | KLocale::KLocale() : mCalendarSystem( 0 ) |
167 | { | 167 | { |
168 | 168 | ||
169 | m_decimalSymbol = "."; | 169 | m_decimalSymbol = "."; |
170 | m_positiveSign = ""; | 170 | m_positiveSign = ""; |
171 | m_negativeSign = "-"; | 171 | m_negativeSign = "-"; |
172 | m_thousandsSeparator = ","; | 172 | m_thousandsSeparator = ","; |
173 | 173 | ||
174 | 174 | ||
175 | 175 | ||
176 | 176 | ||
177 | mWeekStartsMonday = true; | 177 | mWeekStartsMonday = true; |
178 | mHourF24Format = true; | 178 | mHourF24Format = true; |
179 | mIntDateFormat = Default; | 179 | mIntDateFormat = Default; |
180 | mIntTimeFormat = Default; | 180 | mIntTimeFormat = Default; |
181 | mLanguage = 0; | 181 | mLanguage = 0; |
182 | mDateFormat = "%a %Y %b %d"; | 182 | mDateFormat = "%a %Y %b %d"; |
183 | mDateFormatShort = "%Y-%m-%d"; | 183 | mDateFormatShort = "%Y-%m-%d"; |
184 | mTimeZoneList << ("-11:00 US/Samoa") | 184 | mTimeZoneList << ("-11:00 US/Samoa") |
185 | << ("-10:00 US/Hawaii") | 185 | << ("-10:00 US/Hawaii") |
186 | << ("-09:00 US/Alaska") | 186 | << ("-09:00 US/Alaska") |
187 | << ("-08:00 US/Pacific") | 187 | << ("-08:00 US/Pacific") |
188 | << ("-07:00 US/Mountain") | 188 | << ("-07:00 US/Mountain") |
189 | << ("-06:00 US/Central") | 189 | << ("-06:00 US/Central") |
190 | << ("-05:00 US/Eastern") | 190 | << ("-05:00 US/Eastern") |
191 | << ("-04:00 Brazil/West") | 191 | << ("-04:00 Brazil/West") |
192 | << ("-03:00 Brazil/East") | 192 | << ("-03:00 Brazil/East") |
193 | << ("-02:00 Brazil/DeNoronha") | 193 | << ("-02:00 Brazil/DeNoronha") |
194 | << ("-01:00 Atlantic/Azores") | 194 | << ("-01:00 Atlantic/Azores") |
195 | << (" 00:00 Europe/London(UTC)") | 195 | << (" 00:00 Europe/London(UTC)") |
196 | << ("+01:00 Europe/Oslo(CET)") | 196 | << ("+01:00 Europe/Oslo(CET)") |
197 | << ("+02:00 Europe/Helsinki") | 197 | << ("+02:00 Europe/Helsinki") |
198 | << ("+03:00 Europe/Moscow") | 198 | << ("+03:00 Europe/Moscow") |
199 | << ("+04:00 Indian/Mauritius") | 199 | << ("+04:00 Indian/Mauritius") |
200 | << ("+05:00 Indian/Maldives") | 200 | << ("+05:00 Indian/Maldives") |
201 | << ("+06:00 Indian/Chagos") | 201 | << ("+06:00 Indian/Chagos") |
202 | << ("+07:00 Asia/Bangkok") | 202 | << ("+07:00 Asia/Bangkok") |
203 | << ("+08:00 Asia/Hongkong") | 203 | << ("+08:00 Asia/Hongkong") |
204 | << ("+09:00 Asia/Tokyo") | 204 | << ("+09:00 Asia/Tokyo") |
205 | << ("+10:00 Asia/Vladivostok") | 205 | << ("+10:00 Asia/Vladivostok") |
206 | << ("+11:00 Asia/Magadan") | 206 | << ("+11:00 Asia/Magadan") |
207 | << ("+12:00 Asia/Kamchatka") | 207 | << ("+12:00 Asia/Kamchatka") |
208 | // << (" xx:xx User defined offset") | 208 | // << (" xx:xx User defined offset") |
209 | << i18n (" Local Time"); | 209 | << i18n (" Local Time"); |
210 | mSouthDaylight = false; | 210 | mSouthDaylight = false; |
211 | mTimeZoneOffset = 0; | 211 | mTimeZoneOffset = 0; |
212 | daylightEnabled = false; | 212 | daylightEnabled = false; |
213 | } | 213 | } |
214 | 214 | ||
215 | void KLocale::setDateFormat( QString s ) | 215 | void KLocale::setDateFormat( QString s ) |
216 | { | 216 | { |
217 | mDateFormat = s; | 217 | mDateFormat = s; |
218 | } | 218 | } |
219 | 219 | ||
220 | void KLocale::setDateFormatShort( QString s ) | 220 | void KLocale::setDateFormatShort( QString s ) |
221 | { | 221 | { |
222 | mDateFormatShort = s; | 222 | mDateFormatShort = s; |
223 | } | 223 | } |
224 | 224 | ||
225 | void KLocale::setHore24Format ( bool b ) | 225 | void KLocale::setHore24Format ( bool b ) |
226 | { | 226 | { |
227 | mHourF24Format = b; | 227 | mHourF24Format = b; |
228 | } | 228 | } |
229 | void KLocale::setWeekStartMonday( bool b ) | 229 | void KLocale::setWeekStartMonday( bool b ) |
230 | { | 230 | { |
231 | mWeekStartsMonday = b; | 231 | mWeekStartsMonday = b; |
232 | } | 232 | } |
233 | 233 | ||
234 | KLocale::IntDateFormat KLocale::getIntDateFormat( ) | 234 | KLocale::IntDateFormat KLocale::getIntDateFormat( ) |
235 | { | 235 | { |
236 | return mIntDateFormat; | 236 | return mIntDateFormat; |
237 | 237 | ||
238 | } | 238 | } |
239 | void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) | 239 | void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) |
240 | { | 240 | { |
241 | mIntDateFormat = i; | 241 | mIntDateFormat = i; |
242 | } | 242 | } |
243 | KLocale::IntDateFormat KLocale::getIntTimeFormat( ) | 243 | KLocale::IntDateFormat KLocale::getIntTimeFormat( ) |
244 | { | 244 | { |
245 | return mIntTimeFormat; | 245 | return mIntTimeFormat; |
246 | 246 | ||
247 | } | 247 | } |
248 | void KLocale::setIntTimeFormat( KLocale::IntDateFormat i ) | 248 | void KLocale::setIntTimeFormat( KLocale::IntDateFormat i ) |
249 | { | 249 | { |
250 | mIntTimeFormat = i; | 250 | mIntTimeFormat = i; |
251 | } | 251 | } |
252 | 252 | ||
253 | void KLocale::setLanguage( int i ) | 253 | void KLocale::setLanguage( int i ) |
254 | { | 254 | { |
255 | mLanguage = i; | 255 | mLanguage = i; |
256 | } | 256 | } |
257 | int KLocale::language( ) | 257 | int KLocale::language( ) |
258 | { | 258 | { |
259 | return mLanguage; | 259 | return mLanguage; |
260 | } | 260 | } |
261 | QString KLocale::translate( const char *index ) const | 261 | QString KLocale::translate( const char *index ) const |
262 | { | 262 | { |
263 | return i18n( index ); | 263 | return i18n( index ); |
264 | } | 264 | } |
265 | 265 | ||
266 | QString KLocale::translate( const char *, const char *fallback) const | 266 | QString KLocale::translate( const char *, const char *fallback) const |
267 | { | 267 | { |
268 | return i18n( fallback ); | 268 | return i18n( fallback ); |
269 | } | 269 | } |
270 | 270 | ||
271 | QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const | 271 | QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const |
272 | { | 272 | { |
273 | const QString rst = timeFormat(intIntDateFormat); | 273 | const QString rst = timeFormat(intIntDateFormat); |
274 | 274 | ||
275 | // only "pm/am" here can grow, the rest shrinks, but | 275 | // only "pm/am" here can grow, the rest shrinks, but |
276 | // I'm rather safe than sorry | 276 | // I'm rather safe than sorry |
277 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 30]; | 277 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 30]; |
278 | 278 | ||
279 | uint index = 0; | 279 | uint index = 0; |
280 | bool escape = false; | 280 | bool escape = false; |
281 | int number = 0; | 281 | int number = 0; |
282 | 282 | ||
283 | for ( uint format_index = 0; format_index < rst.length(); format_index++ ) | 283 | for ( uint format_index = 0; format_index < rst.length(); format_index++ ) |
284 | { | 284 | { |
285 | if ( !escape ) | 285 | if ( !escape ) |
286 | { | 286 | { |
287 | if ( rst.at( format_index ).unicode() == '%' ) | 287 | if ( rst.at( format_index ).unicode() == '%' ) |
288 | escape = true; | 288 | escape = true; |
289 | else | 289 | else |
290 | buffer[index++] = rst.at( format_index ); | 290 | buffer[index++] = rst.at( format_index ); |
291 | } | 291 | } |
292 | else | 292 | else |
293 | { | 293 | { |
294 | switch ( rst.at( format_index ).unicode() ) | 294 | switch ( rst.at( format_index ).unicode() ) |
295 | { | 295 | { |
296 | case '%': | 296 | case '%': |
297 | buffer[index++] = '%'; | 297 | buffer[index++] = '%'; |
298 | break; | 298 | break; |
299 | case 'H': | 299 | case 'H': |
300 | put_it_in( buffer, index, pTime.hour() ); | 300 | put_it_in( buffer, index, pTime.hour() ); |
301 | break; | 301 | break; |
302 | case 'I': | 302 | case 'I': |
303 | put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 ); | 303 | put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 ); |
304 | break; | 304 | break; |
305 | case 'M': | 305 | case 'M': |
306 | put_it_in( buffer, index, pTime.minute() ); | 306 | put_it_in( buffer, index, pTime.minute() ); |
307 | break; | 307 | break; |
308 | case 'S': | 308 | case 'S': |
309 | if (includeSecs) | 309 | if (includeSecs) |
310 | put_it_in( buffer, index, pTime.second() ); | 310 | put_it_in( buffer, index, pTime.second() ); |
311 | else | 311 | else |
312 | { | 312 | { |
313 | // we remove the seperator sign before the seconds and | 313 | // we remove the seperator sign before the seconds and |
314 | // assume that works everywhere | 314 | // assume that works everywhere |
315 | --index; | 315 | --index; |
316 | break; | 316 | break; |
317 | } | 317 | } |
318 | break; | 318 | break; |
319 | case 'k': | 319 | case 'k': |
320 | number = pTime.hour(); | 320 | number = pTime.hour(); |
321 | case 'l': | 321 | case 'l': |
322 | // to share the code | 322 | // to share the code |
323 | if ( rst.at( format_index ).unicode() == 'l' ) | 323 | if ( rst.at( format_index ).unicode() == 'l' ) |
324 | number = (pTime.hour() + 11) % 12 + 1; | 324 | number = (pTime.hour() + 11) % 12 + 1; |
325 | if ( number / 10 ) | 325 | if ( number / 10 ) |
326 | buffer[index++] = number / 10 + '0'; | 326 | buffer[index++] = number / 10 + '0'; |
327 | buffer[index++] = number % 10 + '0'; | 327 | buffer[index++] = number % 10 + '0'; |
328 | break; | 328 | break; |
329 | case 'p': | 329 | case 'p': |
330 | { | 330 | { |
331 | QString s; | 331 | QString s; |
332 | if ( pTime.hour() >= 12 ) | 332 | if ( pTime.hour() >= 12 ) |
333 | put_it_in( buffer, index, i18n("pm") ); | 333 | put_it_in( buffer, index, i18n("pm") ); |
334 | else | 334 | else |
335 | put_it_in( buffer, index, i18n("am") ); | 335 | put_it_in( buffer, index, i18n("am") ); |
336 | break; | 336 | break; |
337 | } | 337 | } |
338 | default: | 338 | default: |
339 | buffer[index++] = rst.at( format_index ); | 339 | buffer[index++] = rst.at( format_index ); |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | escape = false; | 342 | escape = false; |
343 | } | 343 | } |
344 | } | 344 | } |
345 | QString ret( buffer, index ); | 345 | QString ret( buffer, index ); |
346 | delete [] buffer; | 346 | delete [] buffer; |
347 | return ret; | 347 | return ret; |
348 | } | 348 | } |
349 | 349 | ||
350 | QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const | 350 | QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const |
351 | { | 351 | { |
352 | const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat); | 352 | const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat); |
353 | 353 | ||
354 | // I'm rather safe than sorry | 354 | // I'm rather safe than sorry |
355 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 50]; | 355 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 50]; |
356 | 356 | ||
357 | unsigned int index = 0; | 357 | unsigned int index = 0; |
358 | bool escape = false; | 358 | bool escape = false; |
359 | int number = 0; | 359 | int number = 0; |
360 | 360 | ||
361 | for ( uint format_index = 0; format_index < rst.length(); ++format_index ) | 361 | for ( uint format_index = 0; format_index < rst.length(); ++format_index ) |
362 | { | 362 | { |
363 | if ( !escape ) | 363 | if ( !escape ) |
364 | { | 364 | { |
365 | if ( rst.at( format_index ).unicode() == '%' ) | 365 | if ( rst.at( format_index ).unicode() == '%' ) |
366 | escape = true; | 366 | escape = true; |
367 | else | 367 | else |
368 | buffer[index++] = rst.at( format_index ); | 368 | buffer[index++] = rst.at( format_index ); |
369 | } | 369 | } |
370 | else | 370 | else |
371 | { | 371 | { |
372 | switch ( rst.at( format_index ).unicode() ) | 372 | switch ( rst.at( format_index ).unicode() ) |
373 | { | 373 | { |
374 | case '%': | 374 | case '%': |
375 | buffer[index++] = '%'; | 375 | buffer[index++] = '%'; |
376 | break; | 376 | break; |
377 | case 'Y': | 377 | case 'Y': |
378 | put_it_in( buffer, index, pDate.year() / 100 ); | 378 | put_it_in( buffer, index, pDate.year() / 100 ); |
379 | case 'y': | 379 | case 'y': |
380 | put_it_in( buffer, index, pDate.year() % 100 ); | 380 | put_it_in( buffer, index, pDate.year() % 100 ); |
381 | break; | 381 | break; |
382 | case 'n': | 382 | case 'n': |
383 | number = pDate.month(); | 383 | number = pDate.month(); |
384 | case 'e': | 384 | case 'e': |
385 | // to share the code | 385 | // to share the code |
386 | if ( rst.at( format_index ).unicode() == 'e' ) | 386 | if ( rst.at( format_index ).unicode() == 'e' ) |
387 | number = pDate.day(); | 387 | number = pDate.day(); |
388 | if ( number / 10 ) | 388 | if ( number / 10 ) |
389 | buffer[index++] = number / 10 + '0'; | 389 | buffer[index++] = number / 10 + '0'; |
390 | buffer[index++] = number % 10 + '0'; | 390 | buffer[index++] = number % 10 + '0'; |
391 | break; | 391 | break; |
392 | case 'm': | 392 | case 'm': |
393 | put_it_in( buffer, index, pDate.month() ); | 393 | put_it_in( buffer, index, pDate.month() ); |
394 | break; | 394 | break; |
395 | case 'b': | 395 | case 'b': |
396 | put_it_in( buffer, index, monthName(pDate.month(), true) ); | 396 | put_it_in( buffer, index, monthName(pDate.month(), true) ); |
397 | break; | 397 | break; |
398 | case 'B': | 398 | case 'B': |
399 | put_it_in( buffer, index, monthName(pDate.month(), false) ); | 399 | put_it_in( buffer, index, monthName(pDate.month(), false) ); |
400 | break; | 400 | break; |
401 | case 'd': | 401 | case 'd': |
402 | put_it_in( buffer, index, pDate.day() ); | 402 | put_it_in( buffer, index, pDate.day() ); |
403 | break; | 403 | break; |
404 | case 'a': | 404 | case 'a': |
405 | put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), true) ); | 405 | put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), true) ); |
406 | break; | 406 | break; |
407 | case 'A': | 407 | case 'A': |
408 | put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), false) ); | 408 | put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), false) ); |
409 | break; | 409 | break; |
410 | default: | 410 | default: |
411 | buffer[index++] = rst.at( format_index ); | 411 | buffer[index++] = rst.at( format_index ); |
412 | break; | 412 | break; |
413 | } | 413 | } |
414 | escape = false; | 414 | escape = false; |
415 | } | 415 | } |
416 | } | 416 | } |
417 | QString ret( buffer, index ); | 417 | QString ret( buffer, index ); |
418 | delete [] buffer; | 418 | delete [] buffer; |
419 | return ret; | 419 | return ret; |
420 | } | 420 | } |
421 | 421 | ||
422 | QString KLocale::formatDateTime(const QDateTime &pDateTime, | 422 | QString KLocale::formatDateTime(const QDateTime &pDateTime, |
423 | bool shortFormat, | 423 | bool shortFormat, |
424 | bool includeSeconds, | 424 | bool includeSeconds, |
425 | IntDateFormat intIntDateFormat) const | 425 | IntDateFormat intIntDateFormat) const |
426 | { | 426 | { |
427 | QString format("%1 %2"); | 427 | QString format("%1 %2"); |
428 | 428 | ||
429 | if ( intIntDateFormat == Default ) | 429 | if ( intIntDateFormat == Default ) |
430 | format = "%1 %2"; | 430 | format = "%1 %2"; |
431 | else if ( intIntDateFormat == Format1 ) | 431 | else if ( intIntDateFormat == Format1 ) |
432 | format = "%1 %2"; | 432 | format = "%1 %2"; |
433 | else if ( intIntDateFormat == ISODate ) | 433 | else if ( intIntDateFormat == ISODate ) |
434 | format = "%1T%2"; | 434 | format = "%1T%2"; |
435 | 435 | ||
436 | QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) | 436 | QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) |
437 | .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat )); | 437 | .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat )); |
438 | 438 | ||
439 | //qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() ); | 439 | //qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() ); |
440 | 440 | ||
441 | return res; | 441 | return res; |
442 | } | 442 | } |
443 | 443 | ||
444 | QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const | 444 | QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const |
445 | { | 445 | { |
446 | return formatDateTime(pDateTime, true, true, intIntDateFormat); | 446 | return formatDateTime(pDateTime, true, true, intIntDateFormat); |
447 | } | 447 | } |
448 | 448 | ||
449 | QDate KLocale::readDate(const QString &intstr, bool* ok) const | 449 | QDate KLocale::readDate(const QString &intstr, bool* ok) const |
450 | { | 450 | { |
451 | QDate date; | 451 | QDate date; |
452 | date = readDate(intstr, true, ok); | 452 | date = readDate(intstr, true, ok); |
453 | if (date.isValid()) return date; | 453 | if (date.isValid()) return date; |
454 | return readDate(intstr, false, ok); | 454 | return readDate(intstr, false, ok); |
455 | } | 455 | } |
456 | 456 | ||
457 | QDate KLocale::readDate(const QString &intstr, bool shortFormat, bool* ok) const | 457 | QDate KLocale::readDate(const QString &intstr, bool shortFormat, bool* ok) const |
458 | { | 458 | { |
459 | QString fmt = (shortFormat ? dateFormatShort() : dateFormat()).simplifyWhiteSpace(); | 459 | QString fmt = (shortFormat ? dateFormatShort() : dateFormat()).simplifyWhiteSpace(); |
460 | return readDate( intstr, fmt, ok ); | 460 | return readDate( intstr, fmt, ok ); |
461 | } | 461 | } |
462 | 462 | ||
463 | QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) const | 463 | QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) const |
464 | { | 464 | { |
465 | //kdDebug(173) << "KLocale::readDate intstr=" << intstr << " fmt=" << fmt << endl; | 465 | //kdDebug(173) << "KLocale::readDate intstr=" << intstr << " fmt=" << fmt << endl; |
466 | QString str = intstr.simplifyWhiteSpace().lower(); | 466 | QString str = intstr.simplifyWhiteSpace().lower(); |
467 | int day = -1, month = -1; | 467 | int day = -1, month = -1; |
468 | // allow the year to be omitted if not in the format | 468 | // allow the year to be omitted if not in the format |
469 | int year = QDate::currentDate().year(); | 469 | int year = QDate::currentDate().year(); |
470 | uint strpos = 0; | 470 | uint strpos = 0; |
471 | uint fmtpos = 0; | 471 | uint fmtpos = 0; |
472 | 472 | ||
473 | while (fmt.length() > fmtpos || str.length() > strpos) | 473 | while (fmt.length() > fmtpos || str.length() > strpos) |
474 | { | 474 | { |
475 | if ( !(fmt.length() > fmtpos && str.length() > strpos) ) | 475 | if ( !(fmt.length() > fmtpos && str.length() > strpos) ) |
476 | goto error; | 476 | goto error; |
477 | 477 | ||
478 | QChar c = fmt.at(fmtpos++); | 478 | QChar c = fmt.at(fmtpos++); |
479 | 479 | ||
480 | if (c != '%') { | 480 | if (c != '%') { |
481 | if (c.isSpace()) | 481 | if (c.isSpace()) |
482 | strpos++; | 482 | strpos++; |
483 | else if (c != str.at(strpos++)) | 483 | else if (c != str.at(strpos++)) |
484 | goto error; | 484 | goto error; |
485 | continue; | 485 | continue; |
486 | } | 486 | } |
487 | 487 | ||
488 | // remove space at the begining | 488 | // remove space at the begining |
489 | if (str.length() > strpos && str.at(strpos).isSpace()) | 489 | if (str.length() > strpos && str.at(strpos).isSpace()) |
490 | strpos++; | 490 | strpos++; |
491 | 491 | ||
492 | c = fmt.at(fmtpos++); | 492 | c = fmt.at(fmtpos++); |
493 | switch (c) | 493 | switch (c) |
494 | { | 494 | { |
495 | case 'a': | 495 | case 'a': |
496 | case 'A': | 496 | case 'A': |
497 | // this will just be ignored | 497 | // this will just be ignored |
498 | { // Cristian Tache: porting to Win: Block added because of "j" redefinition | 498 | { // Cristian Tache: porting to Win: Block added because of "j" redefinition |
499 | for (int j = 1; j < 8; j++) { | 499 | for (int j = 1; j < 8; j++) { |
500 | QString s = weekDayName(j, c == 'a').lower(); | 500 | QString s = weekDayName(j, c == 'a').lower(); |
501 | int len = s.length(); | 501 | int len = s.length(); |
502 | if (str.mid(strpos, len) == s) | 502 | if (str.mid(strpos, len) == s) |
503 | strpos += len; | 503 | strpos += len; |
504 | } | 504 | } |
505 | break; | 505 | break; |
506 | } | 506 | } |
507 | case 'b': | 507 | case 'b': |
508 | case 'B': | 508 | case 'B': |
509 | { // Cristian Tache: porting to Win: Block added because of "j" redefinition | 509 | { // Cristian Tache: porting to Win: Block added because of "j" redefinition |
510 | for (int j = 1; j < 13; j++) { | 510 | for (int j = 1; j < 13; j++) { |
511 | QString s = monthName(j, c == 'b').lower(); | 511 | QString s = monthName(j, c == 'b').lower(); |
512 | int len = s.length(); | 512 | int len = s.length(); |
513 | if (str.mid(strpos, len) == s) { | 513 | if (str.mid(strpos, len) == s) { |
514 | month = j; | 514 | month = j; |
515 | strpos += len; | 515 | strpos += len; |
516 | } | 516 | } |
517 | } | 517 | } |
518 | break; | 518 | break; |
519 | } | 519 | } |
520 | case 'd': | 520 | case 'd': |
521 | case 'e': | 521 | case 'e': |
522 | day = readInt(str, strpos); | 522 | day = readInt(str, strpos); |
523 | if (day < 1 || day > 31) | 523 | if (day < 1 || day > 31) |
524 | goto error; | 524 | goto error; |
525 | 525 | ||
526 | break; | 526 | break; |
527 | 527 | ||
528 | case 'n': | 528 | case 'n': |
529 | case 'm': | 529 | case 'm': |
530 | month = readInt(str, strpos); | 530 | month = readInt(str, strpos); |
531 | if (month < 1 || month > 12) | 531 | if (month < 1 || month > 12) |
532 | goto error; | 532 | goto error; |
533 | 533 | ||
534 | break; | 534 | break; |
535 | 535 | ||
536 | case 'Y': | 536 | case 'Y': |
537 | case 'y': | 537 | case 'y': |
538 | year = readInt(str, strpos); | 538 | year = readInt(str, strpos); |
539 | if (year < 0) | 539 | if (year < 0) |
540 | goto error; | 540 | goto error; |
541 | // Qt treats a year in the range 0-100 as 1900-1999. | 541 | // Qt treats a year in the range 0-100 as 1900-1999. |
542 | // It is nicer for the user if we treat 0-68 as 2000-2068 | 542 | // It is nicer for the user if we treat 0-68 as 2000-2068 |
543 | if (year < 69) | 543 | if (year < 69) |
544 | year += 2000; | 544 | year += 2000; |
545 | else if (c == 'y') | 545 | else if (c == 'y') |
546 | year += 1900; | 546 | year += 1900; |
547 | 547 | ||
548 | break; | 548 | break; |
549 | } | 549 | } |
550 | } | 550 | } |
551 | //kdDebug(173) << "KLocale::readDate day=" << day << " month=" << month << " year=" << year << endl; | 551 | //kdDebug(173) << "KLocale::readDate day=" << day << " month=" << month << " year=" << year << endl; |
552 | if ( year != -1 && month != -1 && day != -1 ) | 552 | if ( year != -1 && month != -1 && day != -1 ) |
553 | { | 553 | { |
554 | if (ok) *ok = true; | 554 | if (ok) *ok = true; |
555 | return QDate(year, month, day); | 555 | return QDate(year, month, day); |
556 | } | 556 | } |
557 | error: | 557 | error: |
558 | if (ok) *ok = false; | 558 | if (ok) *ok = false; |
559 | return QDate(); // invalid date | 559 | return QDate(); // invalid date |
560 | } | 560 | } |
561 | 561 | ||
562 | QTime KLocale::readTime(const QString &intstr, bool *ok) const | 562 | QTime KLocale::readTime(const QString &intstr, bool *ok) const |
563 | { | 563 | { |
564 | QTime _time; | 564 | QTime _time; |
565 | _time = readTime(intstr, true, ok); | 565 | _time = readTime(intstr, false, ok); |
566 | if (_time.isValid()) return _time; | 566 | if (_time.isValid()) return _time; |
567 | return readTime(intstr, false, ok); | 567 | return readTime(intstr, true, ok); |
568 | } | 568 | } |
569 | 569 | ||
570 | QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const | 570 | QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const |
571 | { | 571 | { |
572 | QString str = intstr.simplifyWhiteSpace().lower(); | 572 | QString str = intstr.simplifyWhiteSpace().lower(); |
573 | QString Format = timeFormat().simplifyWhiteSpace(); | 573 | QString Format = timeFormat().simplifyWhiteSpace(); |
574 | if (!seconds) | 574 | if (!seconds) |
575 | Format.replace(QRegExp(QString::fromLatin1(".%S")), QString::null); | 575 | Format.replace(QRegExp(QString::fromLatin1(".%S")), QString::null); |
576 | 576 | ||
577 | int hour = -1, minute = -1, second = seconds ? -1 : 0; // don't require seconds | 577 | int hour = -1, minute = -1, second = seconds ? -1 : 0; // don't require seconds |
578 | 578 | ||
579 | bool g_12h = false; | 579 | bool g_12h = false; |
580 | bool pm = false; | 580 | bool pm = false; |
581 | uint strpos = 0; | 581 | uint strpos = 0; |
582 | uint Formatpos = 0; | 582 | uint Formatpos = 0; |
583 | 583 | ||
584 | while (Format.length() > Formatpos || str.length() > strpos) | 584 | while (Format.length() > Formatpos || str.length() > strpos) |
585 | { | 585 | { |
586 | if ( !(Format.length() > Formatpos && str.length() > strpos) ) goto error; | 586 | if ( !(Format.length() > Formatpos && str.length() > strpos) ) goto error; |
587 | 587 | ||
588 | QChar c = Format.at(Formatpos++); | 588 | QChar c = Format.at(Formatpos++); |
589 | 589 | ||
590 | if (c != '%') | 590 | if (c != '%') |
591 | { | 591 | { |
592 | if (c.isSpace()) | 592 | if (c.isSpace()) |
593 | strpos++; | 593 | strpos++; |
594 | else if (c != str.at(strpos++)) | 594 | else if (c != str.at(strpos++)) |
595 | goto error; | 595 | goto error; |
596 | continue; | 596 | continue; |
597 | } | 597 | } |
598 | 598 | ||
599 | // remove space at the begining | 599 | // remove space at the begining |
600 | if (str.length() > strpos && str.at(strpos).isSpace()) | 600 | if (str.length() > strpos && str.at(strpos).isSpace()) |
601 | strpos++; | 601 | strpos++; |
602 | 602 | ||
603 | c = Format.at(Formatpos++); | 603 | c = Format.at(Formatpos++); |
604 | switch (c) | 604 | switch (c) |
605 | { | 605 | { |
606 | case 'p': | 606 | case 'p': |
607 | { | 607 | { |
608 | QString s; | 608 | QString s; |
609 | s = i18n("pm").lower(); | 609 | s = i18n("pm").lower(); |
610 | int len = s.length(); | 610 | int len = s.length(); |
611 | if (str.mid(strpos, len) == s) | 611 | if (str.mid(strpos, len) == s) |
612 | { | 612 | { |
613 | pm = true; | 613 | pm = true; |
614 | strpos += len; | 614 | strpos += len; |
615 | } | 615 | } |
616 | else | 616 | else |
617 | { | 617 | { |
618 | s = i18n("am").lower(); | 618 | s = i18n("am").lower(); |
619 | len = s.length(); | 619 | len = s.length(); |
620 | if (str.mid(strpos, len) == s) { | 620 | if (str.mid(strpos, len) == s) { |
621 | pm = false; | 621 | pm = false; |
622 | strpos += len; | 622 | strpos += len; |
623 | } | 623 | } |
624 | else | 624 | else |
625 | goto error; | 625 | goto error; |
626 | } | 626 | } |
627 | } | 627 | } |
628 | break; | 628 | break; |
629 | 629 | ||
630 | case 'k': | 630 | case 'k': |
631 | case 'H': | 631 | case 'H': |
632 | g_12h = false; | 632 | g_12h = false; |
633 | hour = readInt(str, strpos); | 633 | hour = readInt(str, strpos); |
634 | if (hour < 0 || hour > 23) | 634 | if (hour < 0 || hour > 23) |
635 | goto error; | 635 | goto error; |
636 | 636 | ||
637 | break; | 637 | break; |
638 | 638 | ||
639 | case 'l': | 639 | case 'l': |
640 | case 'I': | 640 | case 'I': |
641 | g_12h = true; | 641 | g_12h = true; |
642 | hour = readInt(str, strpos); | 642 | hour = readInt(str, strpos); |
643 | if (hour < 1 || hour > 12) | 643 | if (hour < 1 || hour > 12) |
644 | goto error; | 644 | goto error; |
645 | 645 | ||
646 | break; | 646 | break; |
647 | 647 | ||
648 | case 'M': | 648 | case 'M': |
649 | minute = readInt(str, strpos); | 649 | minute = readInt(str, strpos); |
650 | if (minute < 0 || minute > 59) | 650 | if (minute < 0 || minute > 59) |
651 | goto error; | 651 | goto error; |
652 | 652 | ||
653 | break; | 653 | break; |
654 | 654 | ||
655 | case 'S': | 655 | case 'S': |
656 | second = readInt(str, strpos); | 656 | second = readInt(str, strpos); |
657 | if (second < 0 || second > 59) | 657 | if (second < 0 || second > 59) |
658 | goto error; | 658 | goto error; |
659 | 659 | ||
660 | break; | 660 | break; |
661 | } | 661 | } |
662 | } | 662 | } |
663 | if (g_12h) | 663 | if (g_12h) |
664 | { | 664 | { |
665 | hour %= 12; | 665 | hour %= 12; |
666 | if (pm) hour += 12; | 666 | if (pm) hour += 12; |
667 | } | 667 | } |
668 | 668 | ||
669 | if (ok) *ok = true; | 669 | if (ok) *ok = true; |
670 | return QTime(hour, minute, second); | 670 | return QTime(hour, minute, second); |
671 | 671 | ||
672 | error: | 672 | error: |
673 | if (ok) *ok = false; | 673 | if (ok) *ok = false; |
674 | return QTime(-1, -1, -1); // return invalid date if it didn't work | 674 | return QTime(-1, -1, -1); // return invalid date if it didn't work |
675 | // This will be removed in the near future, since it gives a warning on stderr. | 675 | // This will be removed in the near future, since it gives a warning on stderr. |
676 | // The presence of the bool* (since KDE-3.0) removes the need for an invalid QTime. | 676 | // The presence of the bool* (since KDE-3.0) removes the need for an invalid QTime. |
677 | } | 677 | } |
678 | 678 | ||
679 | QDateTime KLocale::readDateTime(const QString &intstr, | 679 | QDateTime KLocale::readDateTime(const QString &intstr, |
680 | IntDateFormat intIntDateFormat, | 680 | IntDateFormat intIntDateFormat, |
681 | bool* ok) const | 681 | bool* ok) const |
682 | { | 682 | { |
683 | bool ok1, ok2; | 683 | bool ok1, ok2; |
684 | 684 | ||
685 | // AT the moment we can not read any other format then ISODate | 685 | // AT the moment we can not read any other format then ISODate |
686 | if ( intIntDateFormat != ISODate ) | 686 | if ( intIntDateFormat != ISODate ) |
687 | { | 687 | { |
688 | qDebug("KLocale::readDateTime, only ISODate is supported."); | 688 | qDebug("KLocale::readDateTime, only ISODate is supported."); |
689 | return QDateTime(); | 689 | return QDateTime(); |
690 | } | 690 | } |
691 | 691 | ||
692 | int pos = intstr.find("T"); | 692 | int pos = intstr.find("T"); |
693 | QString date = intstr.left(pos); | 693 | QString date = intstr.left(pos); |
694 | QString time = intstr.mid(pos+1); | 694 | QString time = intstr.mid(pos+1); |
695 | 695 | ||
696 | QString dformat = dateFormat(intIntDateFormat); | 696 | QString dformat = dateFormat(intIntDateFormat); |
697 | QString tformat = timeFormat(intIntDateFormat); | 697 | QString tformat = timeFormat(intIntDateFormat); |
698 | 698 | ||
699 | QDate m_date = readDate(date, dformat, &ok1); | 699 | QDate m_date = readDate(date, dformat, &ok1); |
700 | QTime m_time = readTime(time, tformat, &ok2); | 700 | QTime m_time = readTime(time, tformat, &ok2); |
701 | 701 | ||
702 | QDateTime m_dt; | 702 | QDateTime m_dt; |
703 | 703 | ||
704 | if (ok) | 704 | if (ok) |
705 | { | 705 | { |
706 | if ((ok1 == false) || (ok2 == false)) | 706 | if ((ok1 == false) || (ok2 == false)) |
707 | *ok = false; | 707 | *ok = false; |
708 | else | 708 | else |
709 | *ok = true; | 709 | *ok = true; |
710 | } | 710 | } |
711 | 711 | ||
712 | //only set values if both operations returned true. | 712 | //only set values if both operations returned true. |
713 | if ((ok1 == true) && (ok2 == true)) | 713 | if ((ok1 == true) && (ok2 == true)) |
714 | { | 714 | { |
715 | m_dt.setDate(m_date); | 715 | m_dt.setDate(m_date); |
716 | m_dt.setTime(m_time); | 716 | m_dt.setTime(m_time); |
717 | } | 717 | } |
718 | 718 | ||
719 | //qDebug("KLocale::readDateTime() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2); | 719 | //qDebug("KLocale::readDateTime() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2); |
720 | return m_dt; | 720 | return m_dt; |
721 | } | 721 | } |
722 | 722 | ||
723 | QDate KLocale::readDate(const QString &intstr, | 723 | QDate KLocale::readDate(const QString &intstr, |
724 | IntDateFormat intIntDateFormat, | 724 | IntDateFormat intIntDateFormat, |
725 | bool* ok) const | 725 | bool* ok) const |
726 | { | 726 | { |
727 | bool ok1; | 727 | bool ok1; |
728 | 728 | ||
729 | QString dformat = dateFormat(intIntDateFormat); | 729 | QString dformat = dateFormat(intIntDateFormat); |
730 | 730 | ||
731 | QDate m_date = readDate(intstr, dformat, &ok1); | 731 | QDate m_date = readDate(intstr, dformat, &ok1); |
732 | 732 | ||
733 | if (ok) | 733 | if (ok) |
734 | *ok = ok1; | 734 | *ok = ok1; |
735 | 735 | ||
736 | //qDebug("KLocale::readDate() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2); | 736 | //qDebug("KLocale::readDate() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2); |
737 | return m_date; | 737 | return m_date; |
738 | } | 738 | } |
739 | 739 | ||
740 | 740 | ||
741 | bool KLocale::use12Clock() const | 741 | bool KLocale::use12Clock() const |
742 | { | 742 | { |
743 | return !mHourF24Format ;; | 743 | return !mHourF24Format ;; |
744 | } | 744 | } |
745 | 745 | ||
746 | bool KLocale::weekStartsMonday() const | 746 | bool KLocale::weekStartsMonday() const |
747 | { | 747 | { |
748 | return mWeekStartsMonday; | 748 | return mWeekStartsMonday; |
749 | } | 749 | } |
750 | 750 | ||
751 | int KLocale::weekStartDay() const | 751 | int KLocale::weekStartDay() const |
752 | { | 752 | { |
753 | if ( mWeekStartsMonday ) | 753 | if ( mWeekStartsMonday ) |
754 | return 1; | 754 | return 1; |
755 | return 7; | 755 | return 7; |
756 | } | 756 | } |
757 | 757 | ||
758 | QString KLocale::weekDayName(int i,bool shortName) const | 758 | QString KLocale::weekDayName(int i,bool shortName) const |
759 | { | 759 | { |
760 | if ( shortName ) | 760 | if ( shortName ) |
761 | switch ( i ) | 761 | switch ( i ) |
762 | { | 762 | { |
763 | case 1: return i18n("Monday", "Mon"); | 763 | case 1: return i18n("Monday", "Mon"); |
764 | case 2: return i18n("Tuesday", "Tue"); | 764 | case 2: return i18n("Tuesday", "Tue"); |
765 | case 3: return i18n("Wednesday", "Wed"); | 765 | case 3: return i18n("Wednesday", "Wed"); |
766 | case 4: return i18n("Thursday", "Thu"); | 766 | case 4: return i18n("Thursday", "Thu"); |
767 | case 5: return i18n("Friday", "Fri"); | 767 | case 5: return i18n("Friday", "Fri"); |
768 | case 6: return i18n("Saturday", "Sat"); | 768 | case 6: return i18n("Saturday", "Sat"); |
769 | case 7: return i18n("Sunday", "Sun"); | 769 | case 7: return i18n("Sunday", "Sun"); |
770 | } | 770 | } |
771 | else | 771 | else |
772 | switch ( i ) | 772 | switch ( i ) |
773 | { | 773 | { |
774 | case 1: return i18n("Monday"); | 774 | case 1: return i18n("Monday"); |
775 | case 2: return i18n("Tuesday"); | 775 | case 2: return i18n("Tuesday"); |
776 | case 3: return i18n("Wednesday"); | 776 | case 3: return i18n("Wednesday"); |
777 | case 4: return i18n("Thursday"); | 777 | case 4: return i18n("Thursday"); |
778 | case 5: return i18n("Friday"); | 778 | case 5: return i18n("Friday"); |
779 | case 6: return i18n("Saturday"); | 779 | case 6: return i18n("Saturday"); |
780 | case 7: return i18n("Sunday"); | 780 | case 7: return i18n("Sunday"); |
781 | } | 781 | } |
782 | 782 | ||
783 | return QString::null; | 783 | return QString::null; |
784 | } | 784 | } |
785 | 785 | ||
786 | QString KLocale::monthName(int i,bool shortName) const | 786 | QString KLocale::monthName(int i,bool shortName) const |
787 | { | 787 | { |
788 | if ( shortName ) | 788 | if ( shortName ) |
789 | switch ( i ) | 789 | switch ( i ) |
790 | { | 790 | { |
791 | case 1: return i18n("January", "Jan"); | 791 | case 1: return i18n("January", "Jan"); |
792 | case 2: return i18n("February", "Feb"); | 792 | case 2: return i18n("February", "Feb"); |
793 | case 3: return i18n("March", "Mar"); | 793 | case 3: return i18n("March", "Mar"); |
794 | case 4: return i18n("April", "Apr"); | 794 | case 4: return i18n("April", "Apr"); |
795 | case 5: return i18n("May short", "May"); | 795 | case 5: return i18n("May short", "May"); |
796 | case 6: return i18n("June", "Jun"); | 796 | case 6: return i18n("June", "Jun"); |
797 | case 7: return i18n("July", "Jul"); | 797 | case 7: return i18n("July", "Jul"); |
798 | case 8: return i18n("August", "Aug"); | 798 | case 8: return i18n("August", "Aug"); |
799 | case 9: return i18n("September", "Sep"); | 799 | case 9: return i18n("September", "Sep"); |
800 | case 10: return i18n("October", "Oct"); | 800 | case 10: return i18n("October", "Oct"); |
801 | case 11: return i18n("November", "Nov"); | 801 | case 11: return i18n("November", "Nov"); |
802 | case 12: return i18n("December", "Dec"); | 802 | case 12: return i18n("December", "Dec"); |
803 | } | 803 | } |
804 | else | 804 | else |
805 | switch (i) | 805 | switch (i) |
806 | { | 806 | { |
807 | case 1: return i18n("January"); | 807 | case 1: return i18n("January"); |
808 | case 2: return i18n("February"); | 808 | case 2: return i18n("February"); |
809 | case 3: return i18n("March"); | 809 | case 3: return i18n("March"); |
810 | case 4: return i18n("April"); | 810 | case 4: return i18n("April"); |
811 | case 5: return i18n("May long", "May"); | 811 | case 5: return i18n("May long", "May"); |
812 | case 6: return i18n("June"); | 812 | case 6: return i18n("June"); |
813 | case 7: return i18n("July"); | 813 | case 7: return i18n("July"); |
814 | case 8: return i18n("August"); | 814 | case 8: return i18n("August"); |
815 | case 9: return i18n("September"); | 815 | case 9: return i18n("September"); |
816 | case 10: return i18n("October"); | 816 | case 10: return i18n("October"); |
817 | case 11: return i18n("November"); | 817 | case 11: return i18n("November"); |
818 | case 12: return i18n("December"); | 818 | case 12: return i18n("December"); |
819 | } | 819 | } |
820 | 820 | ||
821 | return QString::null; | 821 | return QString::null; |
822 | } | 822 | } |
823 | 823 | ||
824 | QString KLocale::country() const | 824 | QString KLocale::country() const |
825 | { | 825 | { |
826 | return QString::null; | 826 | return QString::null; |
827 | } | 827 | } |
828 | 828 | ||
829 | QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const | 829 | QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const |
830 | { | 830 | { |
831 | const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; | 831 | const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; |
832 | 832 | ||
833 | if ( dformat == ISODate ) | 833 | if ( dformat == ISODate ) |
834 | return "%Y-%m-%d"; | 834 | return "%Y-%m-%d"; |
835 | 835 | ||
836 | if ( QApplication::desktop()->width() < 480 ) { | 836 | if ( QApplication::desktop()->width() < 480 ) { |
837 | if ( dformat == Default ) | 837 | if ( dformat == Default ) |
838 | return "%a %d %b %Y"; | 838 | return "%a %d %b %Y"; |
839 | else if ( dformat == Format1 ) | 839 | else if ( dformat == Format1 ) |
840 | return "%a %b %d %Y"; | 840 | return "%a %b %d %Y"; |
841 | } else { | 841 | } else { |
842 | if ( dformat == Default ) | 842 | if ( dformat == Default ) |
843 | return "%A %d %B %Y"; | 843 | return "%A %d %B %Y"; |
844 | else if ( dformat == Format1 ) | 844 | else if ( dformat == Format1 ) |
845 | return "%A %B %d %Y"; | 845 | return "%A %B %d %Y"; |
846 | 846 | ||
847 | } | 847 | } |
848 | return mDateFormat ; | 848 | return mDateFormat ; |
849 | } | 849 | } |
850 | 850 | ||
851 | QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const | 851 | QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const |
852 | { | 852 | { |
853 | const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; | 853 | const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; |
854 | 854 | ||
855 | if ( dformat == Default ) | 855 | if ( dformat == Default ) |
856 | return "%d.%m.%Y"; | 856 | return "%d.%m.%Y"; |
857 | else if ( dformat == Format1 ) | 857 | else if ( dformat == Format1 ) |
858 | return "%m.%d.%Y"; | 858 | return "%m.%d.%Y"; |
859 | else if ( dformat == ISODate ) // = Qt::ISODate | 859 | else if ( dformat == ISODate ) // = Qt::ISODate |
860 | return "%Y-%m-%d"; | 860 | return "%Y-%m-%d"; |
861 | return mDateFormatShort ; | 861 | return mDateFormatShort ; |
862 | 862 | ||
863 | } | 863 | } |
864 | 864 | ||
865 | 865 | ||
866 | QString KLocale::timeFormat(IntDateFormat intIntTimeFormat) const | 866 | QString KLocale::timeFormat(IntDateFormat intIntTimeFormat) const |
867 | { | 867 | { |
868 | const IntDateFormat tformat = (intIntTimeFormat == Undefined)?mIntTimeFormat:intIntTimeFormat; | 868 | const IntDateFormat tformat = (intIntTimeFormat == Undefined)?mIntTimeFormat:intIntTimeFormat; |
869 | 869 | ||
870 | if ( tformat == Default ) | 870 | if ( tformat == Default ) |
871 | if ( mHourF24Format) | 871 | if ( mHourF24Format) |
872 | return "%H:%M:%S"; | 872 | return "%H:%M:%S"; |
873 | else | 873 | else |
874 | return "%I:%M:%S%p"; | 874 | return "%I:%M:%S%p"; |
875 | 875 | ||
876 | else if ( tformat == Format1 ) | 876 | else if ( tformat == Format1 ) |
877 | if ( mHourF24Format) | 877 | if ( mHourF24Format) |
878 | return "%H:%M:%S"; | 878 | return "%H:%M:%S"; |
879 | else | 879 | else |
880 | return "%I:%M:%S%p"; | 880 | return "%I:%M:%S%p"; |
881 | 881 | ||
882 | else if ( tformat == ISODate ) // = Qt::ISODate | 882 | else if ( tformat == ISODate ) // = Qt::ISODate |
883 | if ( mHourF24Format) | 883 | if ( mHourF24Format) |
884 | return "%H:%M:%S"; | 884 | return "%H:%M:%S"; |
885 | else | 885 | else |
886 | return "%I:%M:%S%p"; | 886 | return "%I:%M:%S%p"; |
887 | // to satisfy the compiler | 887 | // to satisfy the compiler |
888 | return "%H:%M:%S"; | 888 | return "%H:%M:%S"; |
889 | } | 889 | } |
890 | 890 | ||
891 | void KLocale::insertCatalogue ( const QString & ) | 891 | void KLocale::insertCatalogue ( const QString & ) |
892 | { | 892 | { |
893 | } | 893 | } |
894 | 894 | ||
895 | KCalendarSystem *KLocale::calendar() | 895 | KCalendarSystem *KLocale::calendar() |
896 | { | 896 | { |
897 | if ( !mCalendarSystem ) { | 897 | if ( !mCalendarSystem ) { |
898 | mCalendarSystem = new KCalendarSystemGregorian; | 898 | mCalendarSystem = new KCalendarSystemGregorian; |
899 | } | 899 | } |
900 | 900 | ||
901 | return mCalendarSystem; | 901 | return mCalendarSystem; |
902 | } | 902 | } |
903 | 903 | ||
904 | int KLocale::timezoneOffset( QString timeZone ) | 904 | int KLocale::timezoneOffset( QString timeZone ) |
905 | { | 905 | { |
906 | int ret = 1001; | 906 | int ret = 1001; |
907 | int index = mTimeZoneList.findIndex( timeZone ); | 907 | int index = mTimeZoneList.findIndex( timeZone ); |
908 | if ( index < 24 ) | 908 | if ( index < 24 ) |
909 | ret = ( index-11 ) * 60 ; | 909 | ret = ( index-11 ) * 60 ; |
910 | return ret; | 910 | return ret; |
911 | } | 911 | } |
912 | 912 | ||
913 | QStringList KLocale::timeZoneList() const | 913 | QStringList KLocale::timeZoneList() const |
914 | { | 914 | { |
915 | return mTimeZoneList; | 915 | return mTimeZoneList; |
916 | } | 916 | } |
917 | void KLocale::setTimezone( const QString &timeZone, bool oddTZ ) | 917 | void KLocale::setTimezone( const QString &timeZone, bool oddTZ ) |
918 | { | 918 | { |
919 | mTimeZoneOffset = timezoneOffset( timeZone ); | 919 | mTimeZoneOffset = timezoneOffset( timeZone ); |
920 | if ( oddTZ ) | 920 | if ( oddTZ ) |
921 | mTimeZoneOffset += 30; | 921 | mTimeZoneOffset += 30; |
922 | } | 922 | } |
923 | 923 | ||
924 | void KLocale::setDaylightSaving( bool b, int start , int end ) | 924 | void KLocale::setDaylightSaving( bool b, int start , int end ) |
925 | { | 925 | { |
926 | daylightEnabled = b; | 926 | daylightEnabled = b; |
927 | daylightStart = start; | 927 | daylightStart = start; |
928 | daylightEnd = end; | 928 | daylightEnd = end; |
929 | mSouthDaylight = (end < start); | 929 | mSouthDaylight = (end < start); |
930 | // qDebug("klocale daylight %d %d %d ", b, start , end ); | 930 | // qDebug("klocale daylight %d %d %d ", b, start , end ); |
931 | } | 931 | } |
932 | 932 | ||
933 | int KLocale::localTimeOffset( const QDateTime &dt ) | 933 | int KLocale::localTimeOffset( const QDateTime &dt ) |
934 | { | 934 | { |
935 | bool addDaylight = false; | 935 | bool addDaylight = false; |
936 | if ( daylightEnabled ) { | 936 | if ( daylightEnabled ) { |
937 | int d_end, d_start; | 937 | int d_end, d_start; |
938 | int dayofyear = dt.date().dayOfYear(); | 938 | int dayofyear = dt.date().dayOfYear(); |
939 | int year = dt.date().year(); | 939 | int year = dt.date().year(); |
940 | int add = 0; | 940 | int add = 0; |
941 | if ( QDate::leapYear(year) ) | 941 | if ( QDate::leapYear(year) ) |
942 | add = 1; | 942 | add = 1; |
943 | QDate date ( year,1,1 ); | 943 | QDate date ( year,1,1 ); |
944 | if ( daylightEnd > 59 ) | 944 | if ( daylightEnd > 59 ) |
945 | d_end = daylightEnd +add; | 945 | d_end = daylightEnd +add; |
946 | else | 946 | else |
947 | d_end = daylightEnd; | 947 | d_end = daylightEnd; |
948 | if ( daylightStart > 59 ) | 948 | if ( daylightStart > 59 ) |
949 | d_start = daylightStart +add; | 949 | d_start = daylightStart +add; |
950 | else | 950 | else |
951 | d_start = daylightStart; | 951 | d_start = daylightStart; |
952 | QDate s_date = date.addDays( d_start -1 ); | 952 | QDate s_date = date.addDays( d_start -1 ); |
953 | QDate e_date = date.addDays( d_end -1 ); | 953 | QDate e_date = date.addDays( d_end -1 ); |
954 | int dof = s_date.dayOfWeek(); | 954 | int dof = s_date.dayOfWeek(); |
955 | if ( dof < 7 ) | 955 | if ( dof < 7 ) |
956 | s_date = s_date.addDays( -dof ); | 956 | s_date = s_date.addDays( -dof ); |
957 | dof = e_date.dayOfWeek(); | 957 | dof = e_date.dayOfWeek(); |
958 | if ( dof < 7 ) | 958 | if ( dof < 7 ) |
959 | e_date = e_date.addDays( -dof ); | 959 | e_date = e_date.addDays( -dof ); |
960 | QTime startTime ( 3,0,0 ); | 960 | QTime startTime ( 3,0,0 ); |
961 | QDateTime startDt( s_date, startTime ); | 961 | QDateTime startDt( s_date, startTime ); |
962 | QDateTime endDt( e_date, startTime ); | 962 | QDateTime endDt( e_date, startTime ); |
963 | //qDebug("dayligt saving start %s end %s ",startDt.toString().latin1(),endDt.toString().latin1( )); | 963 | //qDebug("dayligt saving start %s end %s ",startDt.toString().latin1(),endDt.toString().latin1( )); |
964 | if ( mSouthDaylight ) { | 964 | if ( mSouthDaylight ) { |
965 | if ( ! ( endDt < dt && dt < startDt) ) | 965 | if ( ! ( endDt < dt && dt < startDt) ) |
966 | addDaylight = true; | 966 | addDaylight = true; |
967 | } else { | 967 | } else { |
968 | if ( startDt < dt && dt < endDt ) | 968 | if ( startDt < dt && dt < endDt ) |
969 | addDaylight = true; | 969 | addDaylight = true; |
970 | 970 | ||
971 | 971 | ||
972 | } | 972 | } |
973 | } | 973 | } |
974 | int addMin = 0; | 974 | int addMin = 0; |
975 | if ( addDaylight ) | 975 | if ( addDaylight ) |
976 | addMin = 60; | 976 | addMin = 60; |
977 | return mTimeZoneOffset + addMin; | 977 | return mTimeZoneOffset + addMin; |
978 | } | 978 | } |
979 | // ****************************************************************** | 979 | // ****************************************************************** |
980 | // added LR | 980 | // added LR |
981 | QString KLocale::formatNumber(double num, int precision) const | 981 | QString KLocale::formatNumber(double num, int precision) const |
982 | { | 982 | { |
983 | bool neg = num < 0; | 983 | bool neg = num < 0; |
984 | if (precision == -1) precision = 2; | 984 | if (precision == -1) precision = 2; |
985 | QString res = QString::number(neg?-num:num, 'f', precision); | 985 | QString res = QString::number(neg?-num:num, 'f', precision); |
986 | int pos = res.find('.'); | 986 | int pos = res.find('.'); |
987 | if (pos == -1) pos = res.length(); | 987 | if (pos == -1) pos = res.length(); |
988 | else res.replace(pos, 1, decimalSymbol()); | 988 | else res.replace(pos, 1, decimalSymbol()); |
989 | 989 | ||
990 | while (0 < (pos -= 3)) | 990 | while (0 < (pos -= 3)) |
991 | res.insert(pos, thousandsSeparator()); // thousand sep | 991 | res.insert(pos, thousandsSeparator()); // thousand sep |
992 | 992 | ||
993 | // How can we know where we should put the sign? | 993 | // How can we know where we should put the sign? |
994 | res.prepend(neg?negativeSign():positiveSign()); | 994 | res.prepend(neg?negativeSign():positiveSign()); |
995 | 995 | ||
996 | return res; | 996 | return res; |
997 | } | 997 | } |
998 | QString KLocale::formatNumber(const QString &numStr) const | 998 | QString KLocale::formatNumber(const QString &numStr) const |
999 | { | 999 | { |
1000 | return formatNumber(numStr.toDouble()); | 1000 | return formatNumber(numStr.toDouble()); |
1001 | } | 1001 | } |
1002 | double KLocale::readNumber(const QString &_str, bool * ok) const | 1002 | double KLocale::readNumber(const QString &_str, bool * ok) const |
1003 | { | 1003 | { |
1004 | QString str = _str.stripWhiteSpace(); | 1004 | QString str = _str.stripWhiteSpace(); |
1005 | bool neg = str.find(negativeSign()) == 0; | 1005 | bool neg = str.find(negativeSign()) == 0; |
1006 | if (neg) | 1006 | if (neg) |
1007 | str.remove( 0, negativeSign().length() ); | 1007 | str.remove( 0, negativeSign().length() ); |
1008 | 1008 | ||
1009 | /* will hold the scientific notation portion of the number. | 1009 | /* will hold the scientific notation portion of the number. |
1010 | Example, with 2.34E+23, exponentialPart == "E+23" | 1010 | Example, with 2.34E+23, exponentialPart == "E+23" |
1011 | */ | 1011 | */ |
1012 | QString exponentialPart; | 1012 | QString exponentialPart; |
1013 | int EPos; | 1013 | int EPos; |
1014 | 1014 | ||
1015 | EPos = str.find('E', 0, false); | 1015 | EPos = str.find('E', 0, false); |
1016 | 1016 | ||
1017 | if (EPos != -1) | 1017 | if (EPos != -1) |
1018 | { | 1018 | { |
1019 | exponentialPart = str.mid(EPos); | 1019 | exponentialPart = str.mid(EPos); |
1020 | str = str.left(EPos); | 1020 | str = str.left(EPos); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | int pos = str.find(decimalSymbol()); | 1023 | int pos = str.find(decimalSymbol()); |
1024 | QString major; | 1024 | QString major; |
1025 | QString minor; | 1025 | QString minor; |
1026 | if ( pos == -1 ) | 1026 | if ( pos == -1 ) |
1027 | major = str; | 1027 | major = str; |
1028 | else | 1028 | else |
1029 | { | 1029 | { |
1030 | major = str.left(pos); | 1030 | major = str.left(pos); |
1031 | minor = str.mid(pos + decimalSymbol().length()); | 1031 | minor = str.mid(pos + decimalSymbol().length()); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | // Remove thousand separators | 1034 | // Remove thousand separators |
1035 | int thlen = thousandsSeparator().length(); | 1035 | int thlen = thousandsSeparator().length(); |
1036 | int lastpos = 0; | 1036 | int lastpos = 0; |
1037 | while ( ( pos = major.find( thousandsSeparator() ) ) > 0 ) | 1037 | while ( ( pos = major.find( thousandsSeparator() ) ) > 0 ) |
1038 | { | 1038 | { |
1039 | // e.g. 12,,345,,678,,922 Acceptable positions (from the end) are 5, 10, 15... i.e. (3+thlen)*N | 1039 | // e.g. 12,,345,,678,,922 Acceptable positions (from the end) are 5, 10, 15... i.e. (3+thlen)*N |
1040 | int fromEnd = major.length() - pos; | 1040 | int fromEnd = major.length() - pos; |
1041 | if ( fromEnd % (3+thlen) != 0 // Needs to be a multiple, otherwise it's an error | 1041 | if ( fromEnd % (3+thlen) != 0 // Needs to be a multiple, otherwise it's an error |
1042 | || pos - lastpos > 3 // More than 3 digits between two separators -> error | 1042 | || pos - lastpos > 3 // More than 3 digits between two separators -> error |
1043 | || pos == 0 // Can't start with a separator | 1043 | || pos == 0 // Can't start with a separator |
1044 | || (lastpos>0 && pos-lastpos!=3)) // Must have exactly 3 digits between two separators | 1044 | || (lastpos>0 && pos-lastpos!=3)) // Must have exactly 3 digits between two separators |
1045 | { | 1045 | { |
1046 | if (ok) *ok = false; | 1046 | if (ok) *ok = false; |
1047 | return 0.0; | 1047 | return 0.0; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | lastpos = pos; | 1050 | lastpos = pos; |
1051 | major.remove( pos, thlen ); | 1051 | major.remove( pos, thlen ); |
1052 | } | 1052 | } |
1053 | if (lastpos>0 && major.length()-lastpos!=3) // Must have exactly 3 digits after the last separator | 1053 | if (lastpos>0 && major.length()-lastpos!=3) // Must have exactly 3 digits after the last separator |
1054 | { | 1054 | { |
1055 | if (ok) *ok = false; | 1055 | if (ok) *ok = false; |
1056 | return 0.0; | 1056 | return 0.0; |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | QString tot; | 1059 | QString tot; |
1060 | if (neg) tot = '-'; | 1060 | if (neg) tot = '-'; |
1061 | 1061 | ||
1062 | tot += major + '.' + minor + exponentialPart; | 1062 | tot += major + '.' + minor + exponentialPart; |
1063 | 1063 | ||
1064 | return tot.toDouble(ok); | 1064 | return tot.toDouble(ok); |
1065 | } | 1065 | } |
1066 | QString KLocale::decimalSymbol() const | 1066 | QString KLocale::decimalSymbol() const |
1067 | { | 1067 | { |
1068 | 1068 | ||
1069 | return m_decimalSymbol; | 1069 | return m_decimalSymbol; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | QString KLocale::thousandsSeparator() const | 1072 | QString KLocale::thousandsSeparator() const |
1073 | { | 1073 | { |
1074 | 1074 | ||
1075 | return m_thousandsSeparator; | 1075 | return m_thousandsSeparator; |
1076 | } | 1076 | } |
1077 | QString KLocale::positiveSign() const | 1077 | QString KLocale::positiveSign() const |
1078 | { | 1078 | { |
1079 | return m_positiveSign; | 1079 | return m_positiveSign; |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | QString KLocale::negativeSign() const | 1082 | QString KLocale::negativeSign() const |
1083 | { | 1083 | { |
1084 | return m_negativeSign; | 1084 | return m_negativeSign; |
1085 | } | 1085 | } |