author | zautrix <zautrix> | 2005-03-28 23:39:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-28 23:39:37 (UTC) |
commit | 4e7c45695672ecdbd0cd14cac0ea29a8e134ee78 (patch) (unidiff) | |
tree | 6815e055d6cb35d56d43f036261f5be9d2a9c350 | |
parent | 4034290f894ff7d1b0cf1197078e0ed832566bb7 (diff) | |
download | kdepimpi-4e7c45695672ecdbd0cd14cac0ea29a8e134ee78.zip kdepimpi-4e7c45695672ecdbd0cd14cac0ea29a8e134ee78.tar.gz kdepimpi-4e7c45695672ecdbd0cd14cac0ea29a8e134ee78.tar.bz2 |
montview sunday fix
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 18 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 25 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 28 | ||||
-rw-r--r-- | microkde/kdecore/klocale.cpp | 37 | ||||
-rw-r--r-- | microkde/kdecore/klocale.h | 2 |
7 files changed, 64 insertions, 50 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index ce68a1d..b5285bf 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,107 +1,109 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.22 ************ | 3 | ********** VERSION 2.0.22 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Fix for creating events/todos via the abgenda context menu. | 6 | Fix for creating events/todos via the abgenda context menu. |
7 | Added option to split toolbar to 3 toolbars. | 7 | Added option to split toolbar to 3 toolbars. |
8 | Added option to show one small filter-view-toolbar. | 8 | Added option to show one small filter-view-toolbar. |
9 | Added a print option to the desktop version: | 9 | Added a print option to the desktop version: |
10 | Now you can print out the view of the "Event Viewer". | 10 | Now you can print out the view of the "Event Viewer". |
11 | That means you can print all data of one particular event/todo. | 11 | That means you can print all data of one particular event/todo. |
12 | Added scaling options to printout of Event Viewer and What'sNext View. | ||
13 | Fixed some problems in the month view in "week start sunday" mode. | ||
12 | 14 | ||
13 | ********** VERSION 2.0.21 ************ | 15 | ********** VERSION 2.0.21 ************ |
14 | 16 | ||
15 | Fixed another SMTP problem in OM/Pi. | 17 | Fixed another SMTP problem in OM/Pi. |
16 | Some small changed in the new datenavigator in KO/Pi. | 18 | Some small changed in the new datenavigator in KO/Pi. |
17 | Changed default setting for new filter in KA/Pi to "exclude categories". | 19 | Changed default setting for new filter in KA/Pi to "exclude categories". |
18 | Changed the default font size for 640x480 display . | 20 | Changed the default font size for 640x480 display . |
19 | Changed popup menu behaviour in agenda and list view. | 21 | Changed popup menu behaviour in agenda and list view. |
20 | Fixed some layout problems of the date label size in the month view. | 22 | Fixed some layout problems of the date label size in the month view. |
21 | Made month view update faster. | 23 | Made month view update faster. |
22 | Made first datenavigator repainting faster. | 24 | Made first datenavigator repainting faster. |
23 | Changed the title of the event/todo edit dialogs. | 25 | Changed the title of the event/todo edit dialogs. |
24 | Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course). | 26 | Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course). |
25 | Many small usebility fixes in KO/Pi. | 27 | Many small usebility fixes in KO/Pi. |
26 | Pressing the "Calendar" button on the Z switches now to the next view in KO/Pi. | 28 | Pressing the "Calendar" button on the Z switches now to the next view in KO/Pi. |
27 | The set of possible "next views" are the views you have toolbar buttons for. | 29 | The set of possible "next views" are the views you have toolbar buttons for. |
28 | 30 | ||
29 | Made alarm sound working on Linux. | 31 | Made alarm sound working on Linux. |
30 | 32 | ||
31 | KO/Pi alarm applet changed: | 33 | KO/Pi alarm applet changed: |
32 | Made buttons in alarm dialog much bigger. | 34 | Made buttons in alarm dialog much bigger. |
33 | Made setting of timer more user friendly by showing the actual timer fire time and making the buttons in the timer settings much bigger. | 35 | Made setting of timer more user friendly by showing the actual timer fire time and making the buttons in the timer settings much bigger. |
34 | The goal was it to make it possible to use a finger tip ( and not the stylus ) on the touchscreen to adjust the settings. | 36 | The goal was it to make it possible to use a finger tip ( and not the stylus ) on the touchscreen to adjust the settings. |
35 | 37 | ||
36 | And because this version is realeased at Easter, I added an Easter-egg: | 38 | And because this version is realeased at Easter, I added an Easter-egg: |
37 | With a new undocumented command you can get a message box about the next alarm. | 39 | With a new undocumented command you can get a message box about the next alarm. |
38 | Good luck to find it! | 40 | Good luck to find it! |
39 | 41 | ||
40 | 42 | ||
41 | 43 | ||
42 | ********** VERSION 2.0.20 ************ | 44 | ********** VERSION 2.0.20 ************ |
43 | 45 | ||
44 | Two small fixes in OM/Pi. | 46 | Two small fixes in OM/Pi. |
45 | 47 | ||
46 | Better resizing of the new datenavigator in KO/Pi. | 48 | Better resizing of the new datenavigator in KO/Pi. |
47 | 49 | ||
48 | ********** VERSION 2.0.19 ************ | 50 | ********** VERSION 2.0.19 ************ |
49 | KO/Pi: | 51 | KO/Pi: |
50 | Enhancements and bugfixes in the new datenavigator. | 52 | Enhancements and bugfixes in the new datenavigator. |
51 | Bugfix in this changelog: | 53 | Bugfix in this changelog: |
52 | The datenavigator was changed in version 2.0.18, not the datepicker. | 54 | The datenavigator was changed in version 2.0.18, not the datepicker. |
53 | 55 | ||
54 | ********** VERSION 2.0.18 ************ | 56 | ********** VERSION 2.0.18 ************ |
55 | KO/Pi: | 57 | KO/Pi: |
56 | Fixed some minor problems. | 58 | Fixed some minor problems. |
57 | Cleaned up the KO/Pi config dialog. | 59 | Cleaned up the KO/Pi config dialog. |
58 | Fixed problem moving events in aganda view. | 60 | Fixed problem moving events in aganda view. |
59 | Made datepicker scaleable, i.e. if the datenavigator shows now a | 61 | Made datepicker scaleable, i.e. if the datenavigator shows now a |
60 | datenavigator matrix depending on its size. | 62 | datenavigator matrix depending on its size. |
61 | Birthdays are now displayed green in the datenavigator. | 63 | Birthdays are now displayed green in the datenavigator. |
62 | What'sThis Help in datenavigator shows all events of the day. | 64 | What'sThis Help in datenavigator shows all events of the day. |
63 | 65 | ||
64 | OM/Pi: | 66 | OM/Pi: |
65 | Updated the backend mail library to the latest version. | 67 | Updated the backend mail library to the latest version. |
66 | Please backup your mail before using this version. | 68 | Please backup your mail before using this version. |
67 | 69 | ||
68 | ********** VERSION 2.0.17 ************ | 70 | ********** VERSION 2.0.17 ************ |
69 | 71 | ||
70 | KO/Pi: | 72 | KO/Pi: |
71 | Tooltips in month view were not sorted. Fixed. | 73 | Tooltips in month view were not sorted. Fixed. |
72 | Daylabel in agenda view ( for display of one day ) was too short. Fixed. | 74 | Daylabel in agenda view ( for display of one day ) was too short. Fixed. |
73 | Conflict display dialog for syncing was not on top of other windows. Fixed. | 75 | Conflict display dialog for syncing was not on top of other windows. Fixed. |
74 | Fixed some minor problems. | 76 | Fixed some minor problems. |
75 | 77 | ||
76 | Fixed an endless loop when importing vcs file with RESOURCES entry. | 78 | Fixed an endless loop when importing vcs file with RESOURCES entry. |
77 | 79 | ||
78 | ********** VERSION 2.0.16 ************ | 80 | ********** VERSION 2.0.16 ************ |
79 | OM/Pi: | 81 | OM/Pi: |
80 | Fixed the SMTP account setting the option. | 82 | Fixed the SMTP account setting the option. |
81 | Fixed something in mail sending. | 83 | Fixed something in mail sending. |
82 | 84 | ||
83 | KO/Pi: | 85 | KO/Pi: |
84 | Added possibility to export selected events/todos as vcal file. | 86 | Added possibility to export selected events/todos as vcal file. |
85 | 87 | ||
86 | ********** VERSION 2.0.15 ************ | 88 | ********** VERSION 2.0.15 ************ |
87 | 89 | ||
88 | PwM/Pi: | 90 | PwM/Pi: |
89 | Added keyboard shorcuts for | 91 | Added keyboard shorcuts for |
90 | - toggling summary view (space bar) | 92 | - toggling summary view (space bar) |
91 | - delete item (delete + backspace key) | 93 | - delete item (delete + backspace key) |
92 | - add new item ( i + n key) | 94 | - add new item ( i + n key) |
93 | Fixed length of info in the title. | 95 | Fixed length of info in the title. |
94 | 96 | ||
95 | KO/Pi-KA/Pi: | 97 | KO/Pi-KA/Pi: |
96 | Changed "ME" menu bar entry to an icon. | 98 | Changed "ME" menu bar entry to an icon. |
97 | 99 | ||
98 | KO/Pi: | 100 | KO/Pi: |
99 | Fixed two minor bugs in displaying todos. | 101 | Fixed two minor bugs in displaying todos. |
100 | If in month view a cell is selected, the key shortcut "d" shows now that date. | 102 | If in month view a cell is selected, the key shortcut "d" shows now that date. |
101 | Added complete info for a todo in month view as an icon left of the text. | 103 | Added complete info for a todo in month view as an icon left of the text. |
102 | Fixed problems of displaying data when "<" or ">" are used in summary/location/description. | 104 | Fixed problems of displaying data when "<" or ">" are used in summary/location/description. |
103 | Fixed problem of search dialog size when switching displays. | 105 | Fixed problem of search dialog size when switching displays. |
104 | Cancel key now closes date picker. | 106 | Cancel key now closes date picker. |
105 | Rearranged KO/Pi file menu structure. | 107 | Rearranged KO/Pi file menu structure. |
106 | 108 | ||
107 | OM/Pi: | 109 | OM/Pi: |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 38bddc2..2fca49e 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -229,211 +229,209 @@ void KDateNavigator::enableRollover(RolloverType r) | |||
229 | } | 229 | } |
230 | updateTimer->start(0,true); | 230 | updateTimer->start(0,true); |
231 | lastDayChecked = QDate::currentDate(); | 231 | lastDayChecked = QDate::currentDate(); |
232 | } | 232 | } |
233 | updateRollover=r; | 233 | updateRollover=r; |
234 | } | 234 | } |
235 | 235 | ||
236 | 236 | ||
237 | KDateNavigator::~KDateNavigator() | 237 | KDateNavigator::~KDateNavigator() |
238 | { | 238 | { |
239 | } | 239 | } |
240 | 240 | ||
241 | 241 | ||
242 | void KDateNavigator::passedMidnight() | 242 | void KDateNavigator::passedMidnight() |
243 | { | 243 | { |
244 | QDate today = QDate::currentDate(); | 244 | QDate today = QDate::currentDate(); |
245 | bool emitMonth = false; | 245 | bool emitMonth = false; |
246 | 246 | ||
247 | if (today.month() != lastDayChecked.month()) | 247 | if (today.month() != lastDayChecked.month()) |
248 | { | 248 | { |
249 | if (updateRollover==FollowMonth && | 249 | if (updateRollover==FollowMonth && |
250 | daymatrix->isEndOfMonth()) { | 250 | daymatrix->isEndOfMonth()) { |
251 | goNextMonth(); | 251 | goNextMonth(); |
252 | emitMonth=true; | 252 | emitMonth=true; |
253 | } | 253 | } |
254 | } | 254 | } |
255 | daymatrix->recalculateToday(); | 255 | daymatrix->recalculateToday(); |
256 | daymatrix->repaint( false ); | 256 | daymatrix->repaint( false ); |
257 | emit dayPassed(today); | 257 | emit dayPassed(today); |
258 | if (emitMonth) { emit monthPassed(today); } | 258 | if (emitMonth) { emit monthPassed(today); } |
259 | } | 259 | } |
260 | 260 | ||
261 | /* slot */ void KDateNavigator::possiblyPastMidnight() | 261 | /* slot */ void KDateNavigator::possiblyPastMidnight() |
262 | { | 262 | { |
263 | if (lastDayChecked!=QDate::currentDate()) | 263 | if (lastDayChecked!=QDate::currentDate()) |
264 | { | 264 | { |
265 | passedMidnight(); | 265 | passedMidnight(); |
266 | lastDayChecked=QDate::currentDate(); | 266 | lastDayChecked=QDate::currentDate(); |
267 | } | 267 | } |
268 | // Set the timer to go off 1 second after midnight | 268 | // Set the timer to go off 1 second after midnight |
269 | // or after 8 minutes, whichever comes first. | 269 | // or after 8 minutes, whichever comes first. |
270 | if (updateTimer) | 270 | if (updateTimer) |
271 | { | 271 | { |
272 | QTime now = QTime::currentTime(); | 272 | QTime now = QTime::currentTime(); |
273 | QTime midnight = QTime(23,59,59); | 273 | QTime midnight = QTime(23,59,59); |
274 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); | 274 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); |
275 | 275 | ||
276 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) | 276 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) |
277 | //.arg(now.toString()).arg(midnight.toString())); | 277 | //.arg(now.toString()).arg(midnight.toString())); |
278 | 278 | ||
279 | updateTimer->stop(); | 279 | updateTimer->stop(); |
280 | updateTimer->start(msecsWait,true); | 280 | updateTimer->start(msecsWait,true); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | void KDateNavigator::updateDates() | 284 | void KDateNavigator::updateDates() |
285 | { | 285 | { |
286 | // Find the first day of the week of the current month. | 286 | // Find the first day of the week of the current month. |
287 | //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); | 287 | //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); |
288 | QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); | 288 | QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); |
289 | int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); | 289 | int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); |
290 | //int di = d1 - d2 + 1; | 290 | //int di = d1 - d2 + 1; |
291 | dayone = dayone.addDays( -d2 + 1 ); | 291 | dayone = dayone.addDays( -d2 + 1 ); |
292 | 292 | ||
293 | int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); | 293 | int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); |
294 | 294 | ||
295 | // If month begins on Monday and Monday is first day of week, | 295 | // If month begins on Monday and Monday is first day of week, |
296 | // month should begin on second line. Sunday doesn't have this problem. | 296 | // month should begin on second line. Sunday doesn't have this problem. |
297 | int nextLine = ( ( m_fstDayOfWkCalsys == 1) && | 297 | int nextLine = ( ( m_fstDayOfWkCalsys == 1) && |
298 | ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; | 298 | ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; |
299 | 299 | ||
300 | // update the matrix dates | 300 | // update the matrix dates |
301 | int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; | 301 | int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; |
302 | 302 | ||
303 | 303 | ||
304 | daymatrix->updateView(dayone.addDays(index)); | 304 | daymatrix->updateView(dayone.addDays(index)); |
305 | //each updateDates is followed by an updateView -> repaint is issued there ! | 305 | //each updateDates is followed by an updateView -> repaint is issued there ! |
306 | // daymatrix->repaint(); | 306 | // daymatrix->repaint(); |
307 | } | 307 | } |
308 | 308 | ||
309 | void KDateNavigator::updateDayMatrix() | 309 | void KDateNavigator::updateDayMatrix() |
310 | { | 310 | { |
311 | daymatrix->updateView(); | 311 | daymatrix->updateView(); |
312 | //daymatrix->repaint(); | 312 | //daymatrix->repaint(); |
313 | } | 313 | } |
314 | 314 | ||
315 | 315 | ||
316 | void KDateNavigator::updateView() | 316 | void KDateNavigator::updateView() |
317 | { | 317 | { |
318 | 318 | ||
319 | setUpdatesEnabled( false ); | 319 | setUpdatesEnabled( false ); |
320 | 320 | ||
321 | int i; | 321 | int i; |
322 | 322 | ||
323 | // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; | 323 | // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; |
324 | daymatrix->updateView(); | 324 | daymatrix->updateView(); |
325 | 325 | int sub = 4; | |
326 | if ( ! KGlobal::locale()->weekStartsMonday() ) | ||
327 | --sub; | ||
326 | // set the week numbers. | 328 | // set the week numbers. |
327 | for(i = 0; i < 6; i++) { | 329 | for(i = 0; i < 6; i++) { |
328 | QString weeknum; | ||
329 | // remember, according to ISO 8601, the first week of the year is the | 330 | // remember, according to ISO 8601, the first week of the year is the |
330 | // first week that contains a thursday. Thus we must subtract off 4, | 331 | // first week that contains a thursday. Thus we must subtract off 4, |
331 | // not just 1. | 332 | // not just 1. |
332 | 333 | ||
333 | //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); | 334 | //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); |
334 | int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); | 335 | int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-sub))); |
335 | 336 | int weekNo; | |
336 | int add = 0; | ||
337 | if ( ! KGlobal::locale()->weekStartsMonday() ) | ||
338 | ++add; | ||
339 | if (dayOfYear % 7 != 0) | 337 | if (dayOfYear % 7 != 0) |
340 | weeknum.setNum(dayOfYear / 7 + 1+add); | 338 | weekNo = (dayOfYear / 7 + 1); |
341 | else | 339 | else |
342 | weeknum.setNum(dayOfYear / 7 +add); | 340 | weekNo = (dayOfYear / 7); |
343 | weeknos[i]->setText(weeknum); | 341 | weeknos[i]->setText(QString::number( weekNo )); |
344 | } | 342 | } |
345 | 343 | ||
346 | setUpdatesEnabled( true ); | 344 | setUpdatesEnabled( true ); |
347 | // kdDebug() << "updateView() -> repaint()" << endl; | 345 | // kdDebug() << "updateView() -> repaint()" << endl; |
348 | repaint(); | 346 | repaint(); |
349 | // daymatrix->repaint(); | 347 | // daymatrix->repaint(); |
350 | } | 348 | } |
351 | 349 | ||
352 | void KDateNavigator::updateConfig() | 350 | void KDateNavigator::updateConfig() |
353 | { | 351 | { |
354 | int day; | 352 | int day; |
355 | for(int i=0; i<7; i++) { | 353 | for(int i=0; i<7; i++) { |
356 | // take the first letter of the day name to be the abbreviation | 354 | // take the first letter of the day name to be the abbreviation |
357 | if (KGlobal::locale()->weekStartsMonday()) { | 355 | if (KGlobal::locale()->weekStartsMonday()) { |
358 | day = i+1; | 356 | day = i+1; |
359 | } else { | 357 | } else { |
360 | if (i==0) day = 7; | 358 | if (i==0) day = 7; |
361 | else day = i; | 359 | else day = i; |
362 | } | 360 | } |
363 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, | 361 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, |
364 | true ); | 362 | true ); |
365 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); | 363 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); |
366 | headings[i]->setText( dayName ); | 364 | headings[i]->setText( dayName ); |
367 | } | 365 | } |
368 | updateDates(); | 366 | updateDates(); |
369 | updateView(); | 367 | updateView(); |
370 | } | 368 | } |
371 | 369 | ||
372 | void KDateNavigator::setShowWeekNums(bool enabled) | 370 | void KDateNavigator::setShowWeekNums(bool enabled) |
373 | { | 371 | { |
374 | qDebug("KDateNavigator::setShowWeekNums***************************** "); | 372 | qDebug("KDateNavigator::setShowWeekNums***************************** "); |
375 | m_bShowWeekNums = enabled; | 373 | m_bShowWeekNums = enabled; |
376 | for(int i=0; i<6; i++) { | 374 | for(int i=0; i<6; i++) { |
377 | if(enabled) | 375 | if(enabled) |
378 | weeknos[i]->show(); | 376 | weeknos[i]->show(); |
379 | else | 377 | else |
380 | weeknos[i]->hide(); | 378 | weeknos[i]->hide(); |
381 | } | 379 | } |
382 | resize(size()); | 380 | resize(size()); |
383 | } | 381 | } |
384 | 382 | ||
385 | void KDateNavigator::selectDates(const DateList& dateList) | 383 | void KDateNavigator::selectDates(const DateList& dateList) |
386 | { | 384 | { |
387 | 385 | ||
388 | if (dateList.count() > 0) { | 386 | if (dateList.count() > 0) { |
389 | mNavigatorBar->selectDates( dateList ); | 387 | mNavigatorBar->selectDates( dateList ); |
390 | mSelectedDates = dateList; | 388 | mSelectedDates = dateList; |
391 | 389 | ||
392 | // set our record of the month and year that this datetbl is | 390 | // set our record of the month and year that this datetbl is |
393 | // displaying. | 391 | // displaying. |
394 | m_MthYr = mSelectedDates.first(); | 392 | m_MthYr = mSelectedDates.first(); |
395 | 393 | ||
396 | 394 | ||
397 | // set our record of the first day of the week of the current | 395 | // set our record of the first day of the week of the current |
398 | // month. This needs to be done before calling dayToIndex, since it | 396 | // month. This needs to be done before calling dayToIndex, since it |
399 | // relies on this information being up to date. | 397 | // relies on this information being up to date. |
400 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); | 398 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); |
401 | m_fstDayOfWk = dayone.dayOfWeek(); | 399 | m_fstDayOfWk = dayone.dayOfWeek(); |
402 | 400 | ||
403 | updateDates(); | 401 | updateDates(); |
404 | 402 | ||
405 | daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 403 | daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
406 | 404 | ||
407 | updateView(); | 405 | updateView(); |
408 | } | 406 | } |
409 | } | 407 | } |
410 | 408 | ||
411 | int KDateNavigator::dayNum(int row, int col) | 409 | int KDateNavigator::dayNum(int row, int col) |
412 | { | 410 | { |
413 | return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; | 411 | return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; |
414 | } | 412 | } |
415 | 413 | ||
416 | int KDateNavigator::dayToIndex(int dayNum) | 414 | int KDateNavigator::dayToIndex(int dayNum) |
417 | { | 415 | { |
418 | int row, col; | 416 | int row, col; |
419 | 417 | ||
420 | row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; | 418 | row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; |
421 | if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) | 419 | if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) |
422 | row++; | 420 | row++; |
423 | col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; | 421 | col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; |
424 | return row * 7 + col; | 422 | return row * 7 + col; |
425 | } | 423 | } |
426 | 424 | ||
427 | void KDateNavigator::wheelEvent (QWheelEvent *e) | 425 | void KDateNavigator::wheelEvent (QWheelEvent *e) |
428 | { | 426 | { |
429 | if(e->delta()>0) emit goPrevious(); | 427 | if(e->delta()>0) emit goPrevious(); |
430 | else emit goNext(); | 428 | else emit goNext(); |
431 | 429 | ||
432 | e->accept(); | 430 | e->accept(); |
433 | } | 431 | } |
434 | 432 | ||
435 | bool KDateNavigator::eventFilter (QObject *o,QEvent *e) | 433 | bool KDateNavigator::eventFilter (QObject *o,QEvent *e) |
436 | { | 434 | { |
437 | if (e->type() == QEvent::MouseButtonPress) { | 435 | if (e->type() == QEvent::MouseButtonPress) { |
438 | int i; | 436 | int i; |
439 | for(i=0;i<6;++i) { | 437 | for(i=0;i<6;++i) { |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9085775..d825493 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -908,196 +908,193 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e ) | |||
908 | //qDebug("LW %d ", lineWidth()); | 908 | //qDebug("LW %d ", lineWidth()); |
909 | if ( size > 0 ) | 909 | if ( size > 0 ) |
910 | verticalScrollBar()->setMaximumHeight( size ); | 910 | verticalScrollBar()->setMaximumHeight( size ); |
911 | size = width() - mLabel->width() -lineWidth()-1; | 911 | size = width() - mLabel->width() -lineWidth()-1; |
912 | if ( size > 0 ) | 912 | if ( size > 0 ) |
913 | horizontalScrollBar()->setMaximumWidth( size ); | 913 | horizontalScrollBar()->setMaximumWidth( size ); |
914 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); | 914 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
915 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 915 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
916 | // mItemList->resize ( width(), height () ); | 916 | // mItemList->resize ( width(), height () ); |
917 | if ( e ) | 917 | if ( e ) |
918 | KNoScrollListBox::resizeEvent ( e ); | 918 | KNoScrollListBox::resizeEvent ( e ); |
919 | } | 919 | } |
920 | 920 | ||
921 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 921 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
922 | { | 922 | { |
923 | if ( !item ) return; | 923 | if ( !item ) return; |
924 | 924 | ||
925 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 925 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
926 | Incidence *incidence = eventItem->incidence(); | 926 | Incidence *incidence = eventItem->incidence(); |
927 | if ( incidence ) mMonthView->defaultAction( incidence ); | 927 | if ( incidence ) mMonthView->defaultAction( incidence ); |
928 | } | 928 | } |
929 | void MonthViewCell::showDay() | 929 | void MonthViewCell::showDay() |
930 | { | 930 | { |
931 | emit showDaySignal( date() ); | 931 | emit showDaySignal( date() ); |
932 | } | 932 | } |
933 | void MonthViewCell::newEvent() | 933 | void MonthViewCell::newEvent() |
934 | { | 934 | { |
935 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 935 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
936 | emit newEventSignal( dt ); | 936 | emit newEventSignal( dt ); |
937 | } | 937 | } |
938 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 938 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
939 | { | 939 | { |
940 | static QListBoxItem * lastClicked = 0; | 940 | static QListBoxItem * lastClicked = 0; |
941 | if ( item == 0 ) { | 941 | if ( item == 0 ) { |
942 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 942 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
943 | emit newEventSignal( dt ); | 943 | emit newEventSignal( dt ); |
944 | return; | 944 | return; |
945 | } | 945 | } |
946 | /* | 946 | /* |
947 | if ( lastClicked ) | 947 | if ( lastClicked ) |
948 | if ( ! item ) { | 948 | if ( ! item ) { |
949 | if ( lastClicked->listBox() != item->listBox() ) | 949 | if ( lastClicked->listBox() != item->listBox() ) |
950 | lastClicked->listBox()->clearSelection(); | 950 | lastClicked->listBox()->clearSelection(); |
951 | } | 951 | } |
952 | */ | 952 | */ |
953 | 953 | ||
954 | mMonthView->setSelectedCell( this ); | 954 | mMonthView->setSelectedCell( this ); |
955 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 955 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
956 | select(); | 956 | select(); |
957 | } | 957 | } |
958 | 958 | ||
959 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 959 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
960 | { | 960 | { |
961 | if ( !item ) return; | 961 | if ( !item ) return; |
962 | 962 | ||
963 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 963 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
964 | Incidence *incidence = eventItem->incidence(); | 964 | Incidence *incidence = eventItem->incidence(); |
965 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 965 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
966 | } | 966 | } |
967 | 967 | ||
968 | void MonthViewCell::selection( QListBoxItem *item ) | 968 | void MonthViewCell::selection( QListBoxItem *item ) |
969 | { | 969 | { |
970 | if ( !item ) return; | 970 | if ( !item ) return; |
971 | 971 | ||
972 | mMonthView->setSelectedCell( this ); | 972 | mMonthView->setSelectedCell( this ); |
973 | } | 973 | } |
974 | 974 | ||
975 | 975 | ||
976 | // ******************************************************************************* | 976 | // ******************************************************************************* |
977 | // ******************************************************************************* | 977 | // ******************************************************************************* |
978 | // ******************************************************************************* | 978 | // ******************************************************************************* |
979 | 979 | ||
980 | 980 | ||
981 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 981 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
982 | : KOEventView( calendar, parent, name ), | 982 | : KOEventView( calendar, parent, name ), |
983 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 983 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
984 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 984 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
985 | { | 985 | { |
986 | mShortDayLabelsM = false; | 986 | mShortDayLabelsM = false; |
987 | mShortDayLabelsW = false; | 987 | mShortDayLabelsW = false; |
988 | skipResize = false; | 988 | skipResize = false; |
989 | clPending = true; | 989 | clPending = true; |
990 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 990 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
991 | mWidStack = new QWidgetStack( this ); | 991 | mWidStack = new QWidgetStack( this ); |
992 | QVBoxLayout* hb = new QVBoxLayout( this ); | 992 | QVBoxLayout* hb = new QVBoxLayout( this ); |
993 | mMonthView = new QWidget( mWidStack ); | 993 | mMonthView = new QWidget( mWidStack ); |
994 | mWeekView = new QWidget( mWidStack ); | 994 | mWeekView = new QWidget( mWidStack ); |
995 | #if QT_VERSION >= 0x030000 | 995 | #if QT_VERSION >= 0x030000 |
996 | mWidStack->addWidget(mMonthView ); | 996 | mWidStack->addWidget(mMonthView ); |
997 | mWidStack->addWidget(mWeekView ); | 997 | mWidStack->addWidget(mWeekView ); |
998 | #else | 998 | #else |
999 | mWidStack->addWidget( mMonthView, 1 ); | 999 | mWidStack->addWidget( mMonthView, 1 ); |
1000 | mWidStack->addWidget( mWeekView , 1 ); | 1000 | mWidStack->addWidget( mWeekView , 1 ); |
1001 | #endif | 1001 | #endif |
1002 | hb->addWidget( mNavigatorBar ); | 1002 | hb->addWidget( mNavigatorBar ); |
1003 | hb->addWidget( mWidStack ); | 1003 | hb->addWidget( mWidStack ); |
1004 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | ||
1005 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 1004 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
1006 | if ( mShowWeekView ) | ||
1007 | mWeekStartsMonday = true; | ||
1008 | updatePossible = false; | 1005 | updatePossible = false; |
1009 | //updatePossible = true; | 1006 | //updatePossible = true; |
1010 | mCells.setAutoDelete( true ); | 1007 | mCells.setAutoDelete( true ); |
1011 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1008 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1012 | mDayLabels.resize( mDaysPerWeek ); | 1009 | mDayLabels.resize( mDaysPerWeek ); |
1013 | mDayLabelsW.resize( mDaysPerWeek ); | 1010 | mDayLabelsW.resize( mDaysPerWeek ); |
1014 | QFont bfont = font(); | 1011 | QFont bfont = font(); |
1015 | if ( QApplication::desktop()->width() < 650 ) { | 1012 | if ( QApplication::desktop()->width() < 650 ) { |
1016 | bfont.setPointSize( bfont.pointSize() - 2 ); | 1013 | bfont.setPointSize( bfont.pointSize() - 2 ); |
1017 | } | 1014 | } |
1018 | bfont.setBold( true ); | 1015 | bfont.setBold( true ); |
1019 | int i; | 1016 | int i; |
1020 | 1017 | ||
1021 | for( i = 0; i < mDaysPerWeek; i++ ) { | 1018 | for( i = 0; i < mDaysPerWeek; i++ ) { |
1022 | QLabel *label = new QLabel( mMonthView ); | 1019 | QLabel *label = new QLabel( mMonthView ); |
1023 | label->setFont(bfont); | 1020 | label->setFont(bfont); |
1024 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1021 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1025 | label->setLineWidth(1); | 1022 | label->setLineWidth(1); |
1026 | label->setAlignment(AlignCenter); | 1023 | label->setAlignment(AlignCenter); |
1027 | mDayLabels.insert( i, label ); | 1024 | mDayLabels.insert( i, label ); |
1028 | label = new QLabel( mWeekView ); | 1025 | label = new QLabel( mWeekView ); |
1029 | label->setFont(bfont); | 1026 | label->setFont(bfont); |
1030 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1027 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1031 | label->setLineWidth(1); | 1028 | label->setLineWidth(1); |
1032 | label->setAlignment(AlignCenter); | 1029 | label->setAlignment(AlignCenter); |
1033 | mDayLabelsW.insert( i, label ); | 1030 | mDayLabelsW.insert( i, label ); |
1034 | } | 1031 | } |
1035 | 1032 | ||
1036 | bfont.setBold( false ); | 1033 | bfont.setBold( false ); |
1037 | mWeekLabels.resize( mNumWeeks+1 ); | 1034 | mWeekLabels.resize( mNumWeeks+1 ); |
1038 | mWeekLabelsW.resize( 2 ); | 1035 | mWeekLabelsW.resize( 2 ); |
1039 | for( i = 0; i < mNumWeeks+1; i++ ) { | 1036 | for( i = 0; i < mNumWeeks+1; i++ ) { |
1040 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 1037 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
1041 | label->setFocusPolicy(NoFocus); | 1038 | label->setFocusPolicy(NoFocus); |
1042 | label->setFont(bfont); | 1039 | label->setFont(bfont); |
1043 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1040 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1044 | label->setFlat(true); | 1041 | label->setFlat(true); |
1045 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1042 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1046 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1043 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1047 | //label->setLineWidth(1); | 1044 | //label->setLineWidth(1); |
1048 | //label->setAlignment(AlignCenter); | 1045 | //label->setAlignment(AlignCenter); |
1049 | mWeekLabels.insert( i, label ); | 1046 | mWeekLabels.insert( i, label ); |
1050 | } | 1047 | } |
1051 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1048 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1052 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 1049 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
1053 | 1050 | ||
1054 | for( i = 0; i < 1+1; i++ ) { | 1051 | for( i = 0; i < 1+1; i++ ) { |
1055 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 1052 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
1056 | label->setFocusPolicy(NoFocus); | 1053 | label->setFocusPolicy(NoFocus); |
1057 | label->setFont(bfont); | 1054 | label->setFont(bfont); |
1058 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1055 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1059 | label->setFlat(true); | 1056 | label->setFlat(true); |
1060 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1057 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1061 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1058 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1062 | //label->setLineWidth(1); | 1059 | //label->setLineWidth(1); |
1063 | //label->setAlignment(AlignCenter); | 1060 | //label->setAlignment(AlignCenter); |
1064 | mWeekLabelsW.insert( i, label ); | 1061 | mWeekLabelsW.insert( i, label ); |
1065 | } | 1062 | } |
1066 | mWeekLabelsW[1]->setText( i18n("W")); | 1063 | mWeekLabelsW[1]->setText( i18n("W")); |
1067 | 1064 | ||
1068 | 1065 | ||
1069 | int row, col; | 1066 | int row, col; |
1070 | mCells.resize( mNumCells ); | 1067 | mCells.resize( mNumCells ); |
1071 | for( row = 0; row < mNumWeeks; ++row ) { | 1068 | for( row = 0; row < mNumWeeks; ++row ) { |
1072 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1069 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1073 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 1070 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
1074 | mCells.insert( row * mDaysPerWeek + col, cell ); | 1071 | mCells.insert( row * mDaysPerWeek + col, cell ); |
1075 | 1072 | ||
1076 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1073 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1077 | SLOT( defaultAction( Incidence * ) ) ); | 1074 | SLOT( defaultAction( Incidence * ) ) ); |
1078 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1075 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1079 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1076 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1080 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1077 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1081 | SIGNAL( showDaySignal( QDate ) ) ); | 1078 | SIGNAL( showDaySignal( QDate ) ) ); |
1082 | } | 1079 | } |
1083 | } | 1080 | } |
1084 | mCellsW.resize( mDaysPerWeek ); | 1081 | mCellsW.resize( mDaysPerWeek ); |
1085 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1082 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1086 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 1083 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
1087 | mCellsW.insert( col, cell ); | 1084 | mCellsW.insert( col, cell ); |
1088 | 1085 | ||
1089 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1086 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1090 | SLOT( defaultAction( Incidence * ) ) ); | 1087 | SLOT( defaultAction( Incidence * ) ) ); |
1091 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1088 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1092 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1089 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1093 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1090 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1094 | SIGNAL( showDaySignal( QDate ) ) ); | 1091 | SIGNAL( showDaySignal( QDate ) ) ); |
1095 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 1092 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
1096 | } | 1093 | } |
1097 | 1094 | ||
1098 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 1095 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
1099 | mContextMenu = eventPopup(); | 1096 | mContextMenu = eventPopup(); |
1100 | // updateConfig(); //useless here... | 1097 | // updateConfig(); //useless here... |
1101 | // ... but we need mWidthLongDayLabel computed | 1098 | // ... but we need mWidthLongDayLabel computed |
1102 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1099 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1103 | mWidthLongDayLabel = 0; | 1100 | mWidthLongDayLabel = 0; |
@@ -1124,288 +1121,290 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
1124 | #ifndef DESKTOP_VERSION | 1121 | #ifndef DESKTOP_VERSION |
1125 | resize( QApplication::desktop()->size() ); | 1122 | resize( QApplication::desktop()->size() ); |
1126 | #else | 1123 | #else |
1127 | resize(640, 480 ); | 1124 | resize(640, 480 ); |
1128 | updatePossible = true; | 1125 | updatePossible = true; |
1129 | #endif | 1126 | #endif |
1130 | computeLayout(); | 1127 | computeLayout(); |
1131 | 1128 | ||
1132 | if ( mShowWeekView ) | 1129 | if ( mShowWeekView ) |
1133 | mWidStack->raiseWidget( mWeekView ); | 1130 | mWidStack->raiseWidget( mWeekView ); |
1134 | else | 1131 | else |
1135 | mWidStack->raiseWidget( mMonthView ); | 1132 | mWidStack->raiseWidget( mMonthView ); |
1136 | } | 1133 | } |
1137 | 1134 | ||
1138 | KOMonthView::~KOMonthView() | 1135 | KOMonthView::~KOMonthView() |
1139 | { | 1136 | { |
1140 | delete mContextMenu; | 1137 | delete mContextMenu; |
1141 | } | 1138 | } |
1142 | 1139 | ||
1143 | void KOMonthView::selectInternalWeekNum ( int n ) | 1140 | void KOMonthView::selectInternalWeekNum ( int n ) |
1144 | { | 1141 | { |
1145 | switchView(); | 1142 | switchView(); |
1146 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 1143 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
1147 | emit selectMonth (); | 1144 | emit selectMonth (); |
1148 | else | 1145 | else |
1149 | emit selectWeekNum ( n ); | 1146 | emit selectWeekNum ( n ); |
1150 | } | 1147 | } |
1151 | 1148 | ||
1152 | int KOMonthView::currentWeek() | 1149 | int KOMonthView::currentWeek() |
1153 | { | 1150 | { |
1154 | if ( mShowWeekView ) | 1151 | if ( mShowWeekView ) |
1155 | return mWeekLabelsW[0]->getWeekNum(); | 1152 | return mWeekLabelsW[0]->getWeekNum(); |
1156 | return mWeekLabels[0]->getWeekNum(); | 1153 | return mWeekLabels[0]->getWeekNum(); |
1157 | } | 1154 | } |
1158 | void KOMonthView::switchView() | 1155 | void KOMonthView::switchView() |
1159 | { | 1156 | { |
1160 | if ( selectedCell( ) ) | 1157 | if ( selectedCell( ) ) |
1161 | selectedCell()->deselect(); | 1158 | selectedCell()->deselect(); |
1162 | mShowWeekView = !mShowWeekView; | 1159 | mShowWeekView = !mShowWeekView; |
1163 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 1160 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
1164 | if ( clPending ) { | 1161 | if ( clPending ) { |
1165 | computeLayout(); | 1162 | computeLayout(); |
1166 | updateConfig(); | 1163 | updateConfig(); |
1167 | } | 1164 | } |
1168 | if ( mShowWeekView ) | 1165 | if ( mShowWeekView ) |
1169 | mWidStack->raiseWidget( mWeekView ); | 1166 | mWidStack->raiseWidget( mWeekView ); |
1170 | else | 1167 | else |
1171 | mWidStack->raiseWidget( mMonthView ); | 1168 | mWidStack->raiseWidget( mMonthView ); |
1172 | clPending = false; | 1169 | clPending = false; |
1173 | } | 1170 | } |
1174 | 1171 | ||
1175 | int KOMonthView::maxDatesHint() | 1172 | int KOMonthView::maxDatesHint() |
1176 | { | 1173 | { |
1177 | return mNumCells; | 1174 | return mNumCells; |
1178 | } | 1175 | } |
1179 | 1176 | ||
1180 | int KOMonthView::currentDateCount() | 1177 | int KOMonthView::currentDateCount() |
1181 | { | 1178 | { |
1182 | return mNumCells; | 1179 | return mNumCells; |
1183 | } | 1180 | } |
1184 | 1181 | ||
1185 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 1182 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
1186 | { | 1183 | { |
1187 | QPtrList<Incidence> selected; | 1184 | QPtrList<Incidence> selected; |
1188 | 1185 | ||
1189 | if ( mSelectedCell ) { | 1186 | if ( mSelectedCell ) { |
1190 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 1187 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
1191 | if ( incidence ) selected.append( incidence ); | 1188 | if ( incidence ) selected.append( incidence ); |
1192 | } | 1189 | } |
1193 | 1190 | ||
1194 | return selected; | 1191 | return selected; |
1195 | } | 1192 | } |
1196 | 1193 | ||
1197 | DateList KOMonthView::selectedDates() | 1194 | DateList KOMonthView::selectedDates() |
1198 | { | 1195 | { |
1199 | DateList selected; | 1196 | DateList selected; |
1200 | 1197 | ||
1201 | if ( mSelectedCell ) { | 1198 | if ( mSelectedCell ) { |
1202 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1199 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1203 | if ( qd.isValid() ) selected.append( qd ); | 1200 | if ( qd.isValid() ) selected.append( qd ); |
1204 | } | 1201 | } |
1205 | 1202 | ||
1206 | return selected; | 1203 | return selected; |
1207 | } | 1204 | } |
1208 | 1205 | ||
1209 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1206 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1210 | const QDate &td) | 1207 | const QDate &td) |
1211 | { | 1208 | { |
1212 | #ifndef KORG_NOPRINTER | 1209 | #ifndef KORG_NOPRINTER |
1213 | calPrinter->preview(CalPrinter::Month, fd, td); | 1210 | calPrinter->preview(CalPrinter::Month, fd, td); |
1214 | #endif | 1211 | #endif |
1215 | } | 1212 | } |
1216 | 1213 | ||
1217 | void KOMonthView::updateConfig() | 1214 | void KOMonthView::updateConfig() |
1218 | { | 1215 | { |
1219 | 1216 | ||
1220 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1217 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1221 | 1218 | ||
1222 | if ( mShowWeekView ) { | 1219 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1223 | mWeekStartsMonday = true; | 1220 | mWeekStartsMonday = true; |
1224 | } | 1221 | } |
1225 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1222 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1226 | mWidthLongDayLabel = 0; | 1223 | mWidthLongDayLabel = 0; |
1227 | 1224 | ||
1228 | for (int i = 0; i < 7; i++) { | 1225 | for (int i = 0; i < 7; i++) { |
1229 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1226 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1230 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1227 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1231 | } | 1228 | } |
1232 | bool temp = mShowSatSunComp ; | 1229 | bool temp = mShowSatSunComp ; |
1233 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1230 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1234 | if ( ! mShowWeekView ) { | 1231 | if ( ! mShowWeekView ) { |
1235 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1232 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1236 | computeLayout(); | 1233 | computeLayout(); |
1237 | } | 1234 | } |
1238 | updateDayLabels(); | 1235 | updateDayLabels(); |
1239 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1236 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1240 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1237 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1241 | //resizeEvent( 0 ); | 1238 | //resizeEvent( 0 ); |
1242 | for (uint i = 0; i < mCells.count(); ++i) { | 1239 | for (uint i = 0; i < mCells.count(); ++i) { |
1243 | mCells[i]->updateConfig(); | 1240 | mCells[i]->updateConfig(); |
1244 | } | 1241 | } |
1245 | 1242 | ||
1246 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1243 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1247 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1244 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1248 | } | 1245 | } |
1249 | #ifdef DESKTOP_VERSION | 1246 | #ifdef DESKTOP_VERSION |
1250 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1247 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1251 | #endif | 1248 | #endif |
1252 | updateView(); | 1249 | updateView(); |
1253 | } | 1250 | } |
1254 | 1251 | ||
1255 | void KOMonthView::updateDayLabels() | 1252 | void KOMonthView::updateDayLabels() |
1256 | { | 1253 | { |
1257 | 1254 | ||
1258 | QPtrVector<QLabel> *mDayLabelsT; | 1255 | QPtrVector<QLabel> *mDayLabelsT; |
1259 | 1256 | ||
1260 | mDayLabelsT = &mDayLabelsW; | 1257 | mDayLabelsT = &mDayLabelsW; |
1261 | for (int i = 0; i < 7; i++) { | 1258 | for (int i = 0; i < 7; i++) { |
1262 | if (mWeekStartsMonday) { | 1259 | { |
1263 | bool show = mShortDayLabelsW; | 1260 | bool show = mShortDayLabelsW; |
1264 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1261 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1265 | show = true; | 1262 | show = true; |
1266 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1263 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1267 | } else { | ||
1268 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); | ||
1269 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); | ||
1270 | |||
1271 | } | 1264 | } |
1272 | } | 1265 | } |
1273 | mDayLabelsT = &mDayLabels; | 1266 | mDayLabelsT = &mDayLabels; |
1274 | for (int i = 0; i < 7; i++) { | 1267 | for (int i = 0; i < 7; i++) { |
1275 | if (mWeekStartsMonday) { | 1268 | if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1276 | bool show = mShortDayLabelsM; | 1269 | bool show = mShortDayLabelsM; |
1277 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1270 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1278 | show = true; | 1271 | show = true; |
1279 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1272 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1280 | } else { | 1273 | } else { |
1281 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1274 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1282 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1275 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1283 | 1276 | ||
1284 | } | 1277 | } |
1285 | } | 1278 | } |
1286 | 1279 | ||
1287 | } | 1280 | } |
1288 | 1281 | ||
1289 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1282 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1290 | { | 1283 | { |
1291 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1284 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1292 | 1285 | ||
1293 | QPtrVector<MonthViewCell> *cells; | 1286 | QPtrVector<MonthViewCell> *cells; |
1294 | QPtrVector<QLabel> *dayLabels; | 1287 | QPtrVector<QLabel> *dayLabels; |
1295 | QPtrVector<KOWeekButton> *weekLabels; | 1288 | QPtrVector<KOWeekButton> *weekLabels; |
1296 | int weekNum = 6; | 1289 | int weekNum = 6; |
1290 | mStartDate = start; | ||
1297 | if ( mShowWeekView ) { | 1291 | if ( mShowWeekView ) { |
1298 | weekNum = 1; | 1292 | weekNum = 1; |
1299 | cells = &mCellsW; | 1293 | cells = &mCellsW; |
1300 | dayLabels = &mDayLabelsW; | 1294 | dayLabels = &mDayLabelsW; |
1301 | weekLabels = &mWeekLabelsW; | 1295 | weekLabels = &mWeekLabelsW; |
1296 | if ( !KGlobal::locale()->weekStartsMonday() ) { | ||
1297 | mStartDate = mStartDate.addDays( 1 ); | ||
1298 | } | ||
1302 | } else { | 1299 | } else { |
1303 | cells = &mCells; | 1300 | cells = &mCells; |
1304 | dayLabels = &mDayLabels; | 1301 | dayLabels = &mDayLabels; |
1305 | weekLabels = &mWeekLabels; | 1302 | weekLabels = &mWeekLabels; |
1306 | } | 1303 | } |
1307 | 1304 | ||
1308 | mStartDate = start; | 1305 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1309 | 1306 | ||
1307 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | ||
1308 | mWeekStartsMonday = true; | ||
1309 | } | ||
1310 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1310 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1311 | 1311 | ||
1312 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1312 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1313 | mStartDate = mStartDate.addDays( -1 ); | 1313 | mStartDate = mStartDate.addDays( -1 ); |
1314 | } | 1314 | } |
1315 | |||
1316 | bool primary = false; | 1315 | bool primary = false; |
1317 | uint i; | 1316 | uint i; |
1318 | for( i = 0; i < (*cells).size(); ++i ) { | 1317 | for( i = 0; i < (*cells).size(); ++i ) { |
1319 | QDate date = mStartDate.addDays( i ); | 1318 | QDate date = mStartDate.addDays( i ); |
1320 | (*cells)[i]->setDate( date ); | 1319 | (*cells)[i]->setDate( date ); |
1321 | 1320 | ||
1322 | #ifndef KORG_NOPLUGINS | 1321 | #ifndef KORG_NOPLUGINS |
1323 | // add holiday, if present | 1322 | // add holiday, if present |
1324 | QString hstring(KOCore::self()->holiday(date)); | 1323 | QString hstring(KOCore::self()->holiday(date)); |
1325 | (*cells)[i]->setHoliday( hstring ); | 1324 | (*cells)[i]->setHoliday( hstring ); |
1326 | #endif | 1325 | #endif |
1327 | 1326 | ||
1328 | } | 1327 | } |
1329 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1328 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1330 | for( i = 0; i < weekNum; ++i ) { | 1329 | for( i = 0; i < weekNum; ++i ) { |
1331 | int wno; | 1330 | int wno; |
1332 | // remember, according to ISO 8601, the first week of the year is the | 1331 | // remember, according to ISO 8601, the first week of the year is the |
1333 | // first week that contains a thursday. Thus we must subtract off 4, | 1332 | // first week that contains a thursday. Thus we must subtract off 4, |
1334 | // not just 1. | 1333 | // not just 1. |
1335 | int dayOfYear = date.dayOfYear(); | 1334 | int dayOfYear = date.dayOfYear(); |
1336 | if (dayOfYear % 7 != 0) | 1335 | if (dayOfYear % 7 != 0) |
1337 | wno = dayOfYear / 7 + 1; | 1336 | wno = dayOfYear / 7 + 1; |
1338 | else | 1337 | else |
1339 | wno =dayOfYear / 7; | 1338 | wno =dayOfYear / 7; |
1340 | (*weekLabels)[i]->setWeekNum( wno ); | 1339 | (*weekLabels)[i]->setWeekNum( wno ); |
1341 | date = date.addDays( 7 ); | 1340 | date = date.addDays( 7 ); |
1342 | } | 1341 | } |
1343 | updateView(); | 1342 | updateView(); |
1344 | } | 1343 | } |
1345 | 1344 | ||
1346 | void KOMonthView::showEvents(QPtrList<Event>) | 1345 | void KOMonthView::showEvents(QPtrList<Event>) |
1347 | { | 1346 | { |
1348 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1347 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1349 | } | 1348 | } |
1350 | 1349 | ||
1351 | void KOMonthView::changeEventDisplay(Event *, int) | 1350 | void KOMonthView::changeEventDisplay(Event *, int) |
1352 | { | 1351 | { |
1353 | // this should be re-written to be much more efficient, but this | 1352 | // this should be re-written to be much more efficient, but this |
1354 | // quick-and-dirty-hack gets the job done for right now. | 1353 | // quick-and-dirty-hack gets the job done for right now. |
1355 | updateView(); | 1354 | updateView(); |
1356 | } | 1355 | } |
1357 | 1356 | ||
1358 | void KOMonthView::updateView() | 1357 | void KOMonthView::updateView() |
1359 | { | 1358 | { |
1360 | 1359 | ||
1361 | if ( !updatePossible ) | 1360 | if ( !updatePossible ) |
1362 | return; | 1361 | return; |
1363 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); | 1362 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); |
1364 | //QTime ti; | 1363 | //QTime ti; |
1365 | //ti.start(); | 1364 | //ti.start(); |
1366 | clearSelection(); | 1365 | clearSelection(); |
1367 | QPtrVector<MonthViewCell> *cells; | 1366 | QPtrVector<MonthViewCell> *cells; |
1368 | if ( mShowWeekView ) { | 1367 | if ( mShowWeekView ) { |
1369 | cells = &mCellsW; | 1368 | cells = &mCellsW; |
1370 | } else { | 1369 | } else { |
1371 | cells = &mCells; | 1370 | cells = &mCells; |
1372 | } | 1371 | } |
1373 | #if 1 | 1372 | #if 1 |
1374 | int i; | 1373 | int i; |
1375 | int timeSpan = (*cells).size()-1; | 1374 | int timeSpan = (*cells).size()-1; |
1376 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1375 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1377 | timeSpan = 6; | 1376 | timeSpan = 6; |
1378 | for( i = 0; i < timeSpan + 1; ++i ) { | 1377 | for( i = 0; i < timeSpan + 1; ++i ) { |
1379 | (*cells)[i]->startUpdateCell(); | 1378 | (*cells)[i]->startUpdateCell(); |
1380 | } | 1379 | } |
1381 | 1380 | ||
1382 | QPtrList<Event> events = calendar()->events(); | 1381 | QPtrList<Event> events = calendar()->events(); |
1383 | Event *event; | 1382 | Event *event; |
1384 | QDateTime dt; | 1383 | QDateTime dt; |
1385 | bool ok; | 1384 | bool ok; |
1386 | QDate endDate = mStartDate.addDays( timeSpan ); | 1385 | QDate endDate = mStartDate.addDays( timeSpan ); |
1387 | for( event = events.first(); event; event = events.next() ) { // for event | 1386 | for( event = events.first(); event; event = events.next() ) { // for event |
1388 | if ( event->doesRecur() ) { | 1387 | if ( event->doesRecur() ) { |
1389 | bool last; | 1388 | bool last; |
1390 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1389 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1391 | QDateTime incidenceEnd; | 1390 | QDateTime incidenceEnd; |
1392 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1391 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1393 | bool invalid = false; | 1392 | bool invalid = false; |
1394 | while( true ) { | 1393 | while( true ) { |
1395 | if ( incidenceStart.isValid() ) { | 1394 | if ( incidenceStart.isValid() ) { |
1396 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1395 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1397 | int st = incidenceStart.date().daysTo( endDate ); | 1396 | int st = incidenceStart.date().daysTo( endDate ); |
1398 | if ( st >= 0 ) { // start before timeend | 1397 | if ( st >= 0 ) { // start before timeend |
1399 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1398 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1400 | if ( end >= 0 ) { // end after timestart --- got one! | 1399 | if ( end >= 0 ) { // end after timestart --- got one! |
1401 | //normalize | 1400 | //normalize |
1402 | st = timeSpan - st; | 1401 | st = timeSpan - st; |
1403 | if ( st < 0 ) st = 0; | 1402 | if ( st < 0 ) st = 0; |
1404 | if ( end > timeSpan ) end = timeSpan; | 1403 | if ( end > timeSpan ) end = timeSpan; |
1405 | int iii; | 1404 | int iii; |
1406 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1405 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1407 | for ( iii = st;iii<= end;++iii) | 1406 | for ( iii = st;iii<= end;++iii) |
1408 | (*cells)[iii]->insertEvent( event ); | 1407 | (*cells)[iii]->insertEvent( event ); |
1409 | } | 1408 | } |
1410 | } | 1409 | } |
1411 | } else { | 1410 | } else { |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index a58f6b8..9e724c7 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -193,122 +193,122 @@ public slots: | |||
193 | KOMonthView *mMonthView; | 193 | KOMonthView *mMonthView; |
194 | int currentPalette; | 194 | int currentPalette; |
195 | 195 | ||
196 | QDate mDate; | 196 | QDate mDate; |
197 | bool mPrimary; | 197 | bool mPrimary; |
198 | bool mHoliday; | 198 | bool mHoliday; |
199 | QString mHolidayString; | 199 | QString mHolidayString; |
200 | 200 | ||
201 | //QLabel *mLabel; | 201 | //QLabel *mLabel; |
202 | QPushButton *mLabel; | 202 | QPushButton *mLabel; |
203 | //QListBox *mItemList; | 203 | //QListBox *mItemList; |
204 | #ifdef DESKTOP_VERSION | 204 | #ifdef DESKTOP_VERSION |
205 | static QToolTipGroup *mToolTipGroup; | 205 | static QToolTipGroup *mToolTipGroup; |
206 | #endif | 206 | #endif |
207 | QSize mLabelSize; | 207 | QSize mLabelSize; |
208 | QSize mLabelBigSize; | 208 | QSize mLabelBigSize; |
209 | QPalette mHolidayPalette; | 209 | QPalette mHolidayPalette; |
210 | QPalette mStandardPalette; | 210 | QPalette mStandardPalette; |
211 | QPalette mPrimaryPalette; | 211 | QPalette mPrimaryPalette; |
212 | QPalette mNonPrimaryPalette; | 212 | QPalette mNonPrimaryPalette; |
213 | void setMyPalette(); | 213 | void setMyPalette(); |
214 | QPalette getPalette (); | 214 | QPalette getPalette (); |
215 | 215 | ||
216 | }; | 216 | }; |
217 | 217 | ||
218 | 218 | ||
219 | class KOMonthView: public KOEventView | 219 | class KOMonthView: public KOEventView |
220 | { | 220 | { |
221 | Q_OBJECT | 221 | Q_OBJECT |
222 | public: | 222 | public: |
223 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 223 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
224 | ~KOMonthView(); | 224 | ~KOMonthView(); |
225 | 225 | ||
226 | /** Returns maximum number of days supported by the komonthview */ | 226 | /** Returns maximum number of days supported by the komonthview */ |
227 | virtual int maxDatesHint(); | 227 | virtual int maxDatesHint(); |
228 | 228 | ||
229 | /** Returns number of currently shown dates. */ | 229 | /** Returns number of currently shown dates. */ |
230 | virtual int currentDateCount(); | 230 | virtual int currentDateCount(); |
231 | 231 | ||
232 | /** returns the currently selected events */ | 232 | /** returns the currently selected events */ |
233 | virtual QPtrList<Incidence> selectedIncidences(); | 233 | virtual QPtrList<Incidence> selectedIncidences(); |
234 | 234 | ||
235 | /** returns dates of the currently selected events */ | 235 | /** returns dates of the currently selected events */ |
236 | virtual DateList selectedDates(); | 236 | virtual DateList selectedDates(); |
237 | 237 | ||
238 | virtual void printPreview(CalPrinter *calPrinter, | 238 | virtual void printPreview(CalPrinter *calPrinter, |
239 | const QDate &, const QDate &); | 239 | const QDate &, const QDate &); |
240 | bool isMonthView() { return !mShowWeekView; } | 240 | bool isMonthView() { return !mShowWeekView; } |
241 | bool isUpdatePossible() { return updatePossible; } | 241 | bool isUpdatePossible() { return updatePossible; } |
242 | 242 | ||
243 | MonthViewCell * selectedCell(); | 243 | MonthViewCell * selectedCell(); |
244 | bool skipResize; | 244 | bool skipResize; |
245 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 245 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
246 | public slots: | 246 | public slots: |
247 | virtual void updateView(); | 247 | virtual void updateView(); |
248 | virtual void updateConfig(); | 248 | virtual void updateConfig(); |
249 | virtual void showDates(const QDate &start, const QDate &end); | 249 | virtual void showDates(const QDate &start, const QDate &end); |
250 | virtual void showEvents(QPtrList<Event> eventList); | 250 | virtual void showEvents(QPtrList<Event> eventList); |
251 | 251 | ||
252 | void changeEventDisplay(Event *, int); | 252 | void changeEventDisplay(Event *, int); |
253 | 253 | ||
254 | void clearSelection(); | 254 | void clearSelection(); |
255 | 255 | ||
256 | void showContextMenu( Incidence * ); | 256 | void showContextMenu( Incidence * ); |
257 | 257 | ||
258 | void setSelectedCell( MonthViewCell * ); | 258 | void setSelectedCell( MonthViewCell * ); |
259 | void switchView(); | 259 | void switchView(); |
260 | 260 | ||
261 | protected slots: | 261 | protected slots: |
262 | void slotComputeLayout(); | 262 | void slotComputeLayout(); |
263 | void selectInternalWeekNum ( int ); | 263 | void selectInternalWeekNum ( int ); |
264 | void processSelectionChange(); | 264 | void processSelectionChange(); |
265 | signals: | 265 | signals: |
266 | void nextMonth(); | 266 | void nextMonth(); |
267 | void prevMonth(); | 267 | void prevMonth(); |
268 | void selectWeekNum ( int ); | 268 | void selectWeekNum ( int ); |
269 | void selectMonth (); | 269 | void selectMonth (); |
270 | void showDaySignal( QDate ); | 270 | void showDaySignal( QDate ); |
271 | protected: | 271 | protected: |
272 | void resizeEvent(QResizeEvent *); | 272 | void resizeEvent(QResizeEvent *); |
273 | void viewChanged(); | 273 | void viewChanged(); |
274 | void updateDayLabels(); | 274 | void updateDayLabels(); |
275 | 275 | ||
276 | private: | 276 | private: |
277 | QTimer* mComputeLayoutTimer; | 277 | QTimer* mComputeLayoutTimer; |
278 | NavigatorBar* mNavigatorBar; | 278 | NavigatorBar* mNavigatorBar; |
279 | int currentWeek(); | 279 | int currentWeek(); |
280 | bool clPending; | 280 | bool clPending; |
281 | QWidgetStack * mWidStack; | 281 | QWidgetStack * mWidStack; |
282 | QWidget* mMonthView; | 282 | QWidget* mMonthView; |
283 | QWidget* mWeekView; | 283 | QWidget* mWeekView; |
284 | bool mShowWeekView; | 284 | bool mShowWeekView; |
285 | bool updatePossible; | 285 | bool updatePossible; |
286 | int mDaysPerWeek; | 286 | int mDaysPerWeek; |
287 | int mNumWeeks; | 287 | int mNumWeeks; |
288 | int mNumCells; | 288 | int mNumCells; |
289 | bool mWeekStartsMonday; | 289 | //bool mWeekStartsMonday; |
290 | bool mShowSatSunComp; | 290 | bool mShowSatSunComp; |
291 | void computeLayout(); | 291 | void computeLayout(); |
292 | void computeLayoutWeek(); | 292 | void computeLayoutWeek(); |
293 | 293 | ||
294 | QPtrVector<MonthViewCell> mCells; | 294 | QPtrVector<MonthViewCell> mCells; |
295 | QPtrVector<QLabel> mDayLabels; | 295 | QPtrVector<QLabel> mDayLabels; |
296 | QPtrVector<KOWeekButton> mWeekLabels; | 296 | QPtrVector<KOWeekButton> mWeekLabels; |
297 | QPtrVector<MonthViewCell> mCellsW; | 297 | QPtrVector<MonthViewCell> mCellsW; |
298 | QPtrVector<QLabel> mDayLabelsW; | 298 | QPtrVector<QLabel> mDayLabelsW; |
299 | QPtrVector<KOWeekButton> mWeekLabelsW; | 299 | QPtrVector<KOWeekButton> mWeekLabelsW; |
300 | 300 | ||
301 | bool mShortDayLabelsM; | 301 | bool mShortDayLabelsM; |
302 | bool mShortDayLabelsW; | 302 | bool mShortDayLabelsW; |
303 | int mWidthLongDayLabel; | 303 | int mWidthLongDayLabel; |
304 | 304 | ||
305 | QDate mStartDate; | 305 | QDate mStartDate; |
306 | 306 | ||
307 | MonthViewCell *mSelectedCell; | 307 | MonthViewCell *mSelectedCell; |
308 | 308 | ||
309 | KOEventPopupMenu *mContextMenu; | 309 | KOEventPopupMenu *mContextMenu; |
310 | void keyPressEvent ( QKeyEvent * ) ; | 310 | void keyPressEvent ( QKeyEvent * ) ; |
311 | 311 | ||
312 | }; | 312 | }; |
313 | 313 | ||
314 | #endif | 314 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2da592b..8e52968 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1385,219 +1385,197 @@ void MainWindow::about() | |||
1385 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1385 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1386 | } | 1386 | } |
1387 | void MainWindow::keyBindings() | 1387 | void MainWindow::keyBindings() |
1388 | { | 1388 | { |
1389 | QString cap = i18n("KO/Pi Keys + Colors"); | 1389 | QString cap = i18n("KO/Pi Keys + Colors"); |
1390 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1390 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1391 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1391 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1392 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1392 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1393 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1393 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1394 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1394 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1395 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1395 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1396 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1396 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1397 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1397 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1398 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1398 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1399 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1399 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1400 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1400 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1401 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1401 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1402 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1402 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1403 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1403 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1404 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1404 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1405 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1405 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1406 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1406 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1407 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1407 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1408 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1408 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1409 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1409 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1410 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1410 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1411 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1411 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1412 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1412 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1413 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1413 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1414 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1414 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1415 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1415 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1416 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1416 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1417 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1417 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1418 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1418 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1419 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1419 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1420 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1420 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1421 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1421 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1422 | i18n("<p><h3>In list view:</h3></p>\n") + | 1422 | i18n("<p><h3>In list view:</h3></p>\n") + |
1423 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1423 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1424 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1424 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1425 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1425 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1426 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1426 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1427 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1427 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1428 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1428 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1429 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1429 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1430 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1430 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1431 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1431 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1432 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1432 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1433 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1433 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1434 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1434 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1435 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1435 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1436 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1436 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1437 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1437 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1438 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1438 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1439 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1439 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1440 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1440 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1441 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1441 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1442 | displayText( text, cap); | 1442 | displayText( text, cap); |
1443 | } | 1443 | } |
1444 | void MainWindow::aboutAutoSaving() | 1444 | void MainWindow::aboutAutoSaving() |
1445 | { | 1445 | { |
1446 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1446 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1447 | 1447 | ||
1448 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1448 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1449 | 1449 | ||
1450 | } | 1450 | } |
1451 | void MainWindow::aboutKnownBugs() | 1451 | void MainWindow::aboutKnownBugs() |
1452 | { | 1452 | { |
1453 | QMessageBox* msg; | 1453 | QMessageBox* msg; |
1454 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1454 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1455 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1455 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1456 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1456 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1457 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1457 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1458 | i18n("\nor report them in the bugtracker on\n") + | 1458 | i18n("\nor report them in the bugtracker on\n") + |
1459 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1459 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1460 | QMessageBox::NoIcon, | 1460 | QMessageBox::NoIcon, |
1461 | QMessageBox::Ok, | 1461 | QMessageBox::Ok, |
1462 | QMessageBox::NoButton, | 1462 | QMessageBox::NoButton, |
1463 | QMessageBox::NoButton); | 1463 | QMessageBox::NoButton); |
1464 | msg->exec(); | 1464 | msg->exec(); |
1465 | delete msg; | 1465 | delete msg; |
1466 | 1466 | ||
1467 | } | 1467 | } |
1468 | 1468 | ||
1469 | QString MainWindow::defaultFileName() | 1469 | QString MainWindow::defaultFileName() |
1470 | { | 1470 | { |
1471 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1471 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1472 | } | 1472 | } |
1473 | QString MainWindow::syncFileName() | 1473 | QString MainWindow::syncFileName() |
1474 | { | 1474 | { |
1475 | #ifdef DESKTOP_VERSION | 1475 | #ifdef DESKTOP_VERSION |
1476 | return locateLocal( "tmp", "synccalendar.ics" ); | 1476 | return locateLocal( "tmp", "synccalendar.ics" ); |
1477 | #else | 1477 | #else |
1478 | return QString( "/tmp/synccalendar.ics" ); | 1478 | return QString( "/tmp/synccalendar.ics" ); |
1479 | #endif | 1479 | #endif |
1480 | } | 1480 | } |
1481 | #include "koglobals.h" | ||
1482 | #include <kcalendarsystem.h> | ||
1481 | void MainWindow::updateWeek(QDate seda) | 1483 | void MainWindow::updateWeek(QDate seda) |
1482 | { | 1484 | { |
1483 | int weekNum = 0; | 1485 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1484 | QDate d = QDate ( seda.year(), 1,1); | ||
1485 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | ||
1486 | if ( seda.addDays(6).year() != seda.year() ) { | ||
1487 | if ( seda.year() != d.year() ) { | ||
1488 | if ( d.dayOfWeek() > 4 ) | ||
1489 | d = QDate ( seda.year(), 1,1); | ||
1490 | else | ||
1491 | weekNum = 1; | ||
1492 | } else { | ||
1493 | QDate dd( seda.year()+1, 1,1); | ||
1494 | if ( dd.dayOfWeek() <= 4 ) | ||
1495 | weekNum = 1; | ||
1496 | } | ||
1497 | } | ||
1498 | if ( weekNum == 0 ){ | ||
1499 | int dow = d.dayOfWeek(); | ||
1500 | if ( dow <= 4 ) | ||
1501 | d = d.addDays( 1-dow ); | ||
1502 | else // 5,6,7 | ||
1503 | d = d.addDays( 8-dow ); | ||
1504 | // we have the first week of the year.we are on monday | ||
1505 | weekNum = d.daysTo( seda ) / 7 +1; | ||
1506 | } | ||
1507 | |||
1508 | mWeekPixmap.fill( mWeekBgColor ); | 1486 | mWeekPixmap.fill( mWeekBgColor ); |
1509 | QPainter p ( &mWeekPixmap ); | 1487 | QPainter p ( &mWeekPixmap ); |
1510 | p.setFont( mWeekFont ); | 1488 | p.setFont( mWeekFont ); |
1511 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1489 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1512 | p.end(); | 1490 | p.end(); |
1513 | QIconSet icon3 ( mWeekPixmap ); | 1491 | QIconSet icon3 ( mWeekPixmap ); |
1514 | mWeekAction->setIconSet ( icon3 ); | 1492 | mWeekAction->setIconSet ( icon3 ); |
1515 | 1493 | ||
1516 | } | 1494 | } |
1517 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1495 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1518 | { | 1496 | { |
1519 | updateWeek( selectedDates.first() ); | 1497 | updateWeek( selectedDates.first() ); |
1520 | } | 1498 | } |
1521 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1499 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1522 | { | 1500 | { |
1523 | 1501 | ||
1524 | if ( !incidence ) { | 1502 | if ( !incidence ) { |
1525 | enableIncidenceActions( false ); | 1503 | enableIncidenceActions( false ); |
1526 | 1504 | ||
1527 | mNewSubTodoAction->setEnabled( false ); | 1505 | mNewSubTodoAction->setEnabled( false ); |
1528 | setCaptionToDates(); | 1506 | setCaptionToDates(); |
1529 | return; | 1507 | return; |
1530 | 1508 | ||
1531 | } | 1509 | } |
1532 | 1510 | ||
1533 | //KGlobal::locale()->formatDateTime(nextA, true); | 1511 | //KGlobal::locale()->formatDateTime(nextA, true); |
1534 | QString startString = ""; | 1512 | QString startString = ""; |
1535 | if ( incidence->type() != "Todo" ) { | 1513 | if ( incidence->type() != "Todo" ) { |
1536 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1514 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1537 | if ( incidence->doesFloat() ) { | 1515 | if ( incidence->doesFloat() ) { |
1538 | startString += ": "+incidence->dtStartDateStr( true ); | 1516 | startString += ": "+incidence->dtStartDateStr( true ); |
1539 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1517 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1540 | 1518 | ||
1541 | } else { | 1519 | } else { |
1542 | startString = ": "+incidence->dtStartStr(true); | 1520 | startString = ": "+incidence->dtStartStr(true); |
1543 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1521 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1544 | 1522 | ||
1545 | } | 1523 | } |
1546 | 1524 | ||
1547 | } else { | 1525 | } else { |
1548 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1526 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1549 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1527 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1550 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1528 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1551 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1529 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1552 | bool ok; | 1530 | bool ok; |
1553 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1531 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1554 | if ( ok ) { | 1532 | if ( ok ) { |
1555 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1533 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1556 | startString += i18n(" (%1 y.)"). arg( years ); | 1534 | startString += i18n(" (%1 y.)"). arg( years ); |
1557 | } | 1535 | } |
1558 | } | 1536 | } |
1559 | else | 1537 | else |
1560 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1538 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1561 | } | 1539 | } |
1562 | 1540 | ||
1563 | } | 1541 | } |
1564 | else | 1542 | else |
1565 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1543 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1566 | if ( !incidence->location().isEmpty() ) | 1544 | if ( !incidence->location().isEmpty() ) |
1567 | startString += " (" +incidence->location()+")"; | 1545 | startString += " (" +incidence->location()+")"; |
1568 | setCaption( incidence->summary()+startString); | 1546 | setCaption( incidence->summary()+startString); |
1569 | 1547 | ||
1570 | enableIncidenceActions( true ); | 1548 | enableIncidenceActions( true ); |
1571 | 1549 | ||
1572 | if ( incidence->type() == "Event" ) { | 1550 | if ( incidence->type() == "Event" ) { |
1573 | mShowAction->setText( i18n("Show Event...") ); | 1551 | mShowAction->setText( i18n("Show Event...") ); |
1574 | mEditAction->setText( i18n("Edit Event...") ); | 1552 | mEditAction->setText( i18n("Edit Event...") ); |
1575 | mDeleteAction->setText( i18n("Delete Event...") ); | 1553 | mDeleteAction->setText( i18n("Delete Event...") ); |
1576 | 1554 | ||
1577 | mNewSubTodoAction->setEnabled( false ); | 1555 | mNewSubTodoAction->setEnabled( false ); |
1578 | } else if ( incidence->type() == "Todo" ) { | 1556 | } else if ( incidence->type() == "Todo" ) { |
1579 | mShowAction->setText( i18n("Show Todo...") ); | 1557 | mShowAction->setText( i18n("Show Todo...") ); |
1580 | mEditAction->setText( i18n("Edit Todo...") ); | 1558 | mEditAction->setText( i18n("Edit Todo...") ); |
1581 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1559 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1582 | 1560 | ||
1583 | mNewSubTodoAction->setEnabled( true ); | 1561 | mNewSubTodoAction->setEnabled( true ); |
1584 | } else { | 1562 | } else { |
1585 | mShowAction->setText( i18n("Show...") ); | 1563 | mShowAction->setText( i18n("Show...") ); |
1586 | mShowAction->setText( i18n("Edit...") ); | 1564 | mShowAction->setText( i18n("Edit...") ); |
1587 | mShowAction->setText( i18n("Delete...") ); | 1565 | mShowAction->setText( i18n("Delete...") ); |
1588 | 1566 | ||
1589 | mNewSubTodoAction->setEnabled( false ); | 1567 | mNewSubTodoAction->setEnabled( false ); |
1590 | } | 1568 | } |
1591 | } | 1569 | } |
1592 | 1570 | ||
1593 | void MainWindow::enableIncidenceActions( bool enabled ) | 1571 | void MainWindow::enableIncidenceActions( bool enabled ) |
1594 | { | 1572 | { |
1595 | mShowAction->setEnabled( enabled ); | 1573 | mShowAction->setEnabled( enabled ); |
1596 | mEditAction->setEnabled( enabled ); | 1574 | mEditAction->setEnabled( enabled ); |
1597 | mDeleteAction->setEnabled( enabled ); | 1575 | mDeleteAction->setEnabled( enabled ); |
1598 | 1576 | ||
1599 | mCloneAction->setEnabled( enabled ); | 1577 | mCloneAction->setEnabled( enabled ); |
1600 | mMoveAction->setEnabled( enabled ); | 1578 | mMoveAction->setEnabled( enabled ); |
1601 | mBeamAction->setEnabled( enabled ); | 1579 | mBeamAction->setEnabled( enabled ); |
1602 | mCancelAction->setEnabled( enabled ); | 1580 | mCancelAction->setEnabled( enabled ); |
1603 | } | 1581 | } |
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index 7f31ab1..1d8ae9f 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp | |||
@@ -175,192 +175,229 @@ KLocale::KLocale() : mCalendarSystem( 0 ) | |||
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 | int KLocale::weekNum ( const QDate & date ) | ||
272 | { | ||
273 | QDate seda = date; | ||
274 | int weekNum = 0; | ||
275 | int dayofweek = seda.dayOfWeek(); // 1... 7 Mo .. So. Do = 4 | ||
276 | int daystoprevthursday = (dayofweek + 3) % 7 ; | ||
277 | int dayofyear = seda.dayOfYear(); | ||
278 | int prevThursday = dayofyear - ( daystoprevthursday ); | ||
279 | int subweeknum = 0; | ||
280 | if ( prevThursday < 1 ) { | ||
281 | seda = seda.addDays( - daystoprevthursday ); | ||
282 | dayofyear = seda.dayOfYear(); | ||
283 | prevThursday = dayofyear; | ||
284 | subweeknum = prevThursday / 7; | ||
285 | if ( prevThursday % 7 != 0 ) | ||
286 | ++subweeknum; | ||
287 | } else { | ||
288 | if ( dayofyear >= 360 ) { //maybe week 1 | ||
289 | seda = seda.addDays( 7 - daystoprevthursday ); | ||
290 | dayofyear = seda.dayOfYear(); | ||
291 | if ( dayofyear < 360 && ( dayofweek < 4 || dayofweek == 7 && !mWeekStartsMonday ) ) | ||
292 | return 1; | ||
293 | } | ||
294 | } | ||
295 | if ( ! weekNum ) { | ||
296 | weekNum = prevThursday / 7; | ||
297 | if ( prevThursday % 7 != 0 ) | ||
298 | ++weekNum; | ||
299 | if ( dayofweek < 4 ) | ||
300 | ++weekNum; | ||
301 | else if ( dayofweek == 7 && !mWeekStartsMonday ) | ||
302 | ++weekNum; | ||
303 | if ( weekNum > subweeknum ) | ||
304 | weekNum -= subweeknum; | ||
305 | } | ||
306 | return weekNum; | ||
307 | } | ||
271 | QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const | 308 | QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const |
272 | { | 309 | { |
273 | const QString rst = timeFormat(intIntDateFormat); | 310 | const QString rst = timeFormat(intIntDateFormat); |
274 | 311 | ||
275 | // only "pm/am" here can grow, the rest shrinks, but | 312 | // only "pm/am" here can grow, the rest shrinks, but |
276 | // I'm rather safe than sorry | 313 | // I'm rather safe than sorry |
277 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 30]; | 314 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 30]; |
278 | 315 | ||
279 | uint index = 0; | 316 | uint index = 0; |
280 | bool escape = false; | 317 | bool escape = false; |
281 | int number = 0; | 318 | int number = 0; |
282 | 319 | ||
283 | for ( uint format_index = 0; format_index < rst.length(); format_index++ ) | 320 | for ( uint format_index = 0; format_index < rst.length(); format_index++ ) |
284 | { | 321 | { |
285 | if ( !escape ) | 322 | if ( !escape ) |
286 | { | 323 | { |
287 | if ( rst.at( format_index ).unicode() == '%' ) | 324 | if ( rst.at( format_index ).unicode() == '%' ) |
288 | escape = true; | 325 | escape = true; |
289 | else | 326 | else |
290 | buffer[index++] = rst.at( format_index ); | 327 | buffer[index++] = rst.at( format_index ); |
291 | } | 328 | } |
292 | else | 329 | else |
293 | { | 330 | { |
294 | switch ( rst.at( format_index ).unicode() ) | 331 | switch ( rst.at( format_index ).unicode() ) |
295 | { | 332 | { |
296 | case '%': | 333 | case '%': |
297 | buffer[index++] = '%'; | 334 | buffer[index++] = '%'; |
298 | break; | 335 | break; |
299 | case 'H': | 336 | case 'H': |
300 | put_it_in( buffer, index, pTime.hour() ); | 337 | put_it_in( buffer, index, pTime.hour() ); |
301 | break; | 338 | break; |
302 | case 'I': | 339 | case 'I': |
303 | put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 ); | 340 | put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 ); |
304 | break; | 341 | break; |
305 | case 'M': | 342 | case 'M': |
306 | put_it_in( buffer, index, pTime.minute() ); | 343 | put_it_in( buffer, index, pTime.minute() ); |
307 | break; | 344 | break; |
308 | case 'S': | 345 | case 'S': |
309 | if (includeSecs) | 346 | if (includeSecs) |
310 | put_it_in( buffer, index, pTime.second() ); | 347 | put_it_in( buffer, index, pTime.second() ); |
311 | else | 348 | else |
312 | { | 349 | { |
313 | // we remove the seperator sign before the seconds and | 350 | // we remove the seperator sign before the seconds and |
314 | // assume that works everywhere | 351 | // assume that works everywhere |
315 | --index; | 352 | --index; |
316 | break; | 353 | break; |
317 | } | 354 | } |
318 | break; | 355 | break; |
319 | case 'k': | 356 | case 'k': |
320 | number = pTime.hour(); | 357 | number = pTime.hour(); |
321 | case 'l': | 358 | case 'l': |
322 | // to share the code | 359 | // to share the code |
323 | if ( rst.at( format_index ).unicode() == 'l' ) | 360 | if ( rst.at( format_index ).unicode() == 'l' ) |
324 | number = (pTime.hour() + 11) % 12 + 1; | 361 | number = (pTime.hour() + 11) % 12 + 1; |
325 | if ( number / 10 ) | 362 | if ( number / 10 ) |
326 | buffer[index++] = number / 10 + '0'; | 363 | buffer[index++] = number / 10 + '0'; |
327 | buffer[index++] = number % 10 + '0'; | 364 | buffer[index++] = number % 10 + '0'; |
328 | break; | 365 | break; |
329 | case 'p': | 366 | case 'p': |
330 | { | 367 | { |
331 | QString s; | 368 | QString s; |
332 | if ( pTime.hour() >= 12 ) | 369 | if ( pTime.hour() >= 12 ) |
333 | put_it_in( buffer, index, i18n("pm") ); | 370 | put_it_in( buffer, index, i18n("pm") ); |
334 | else | 371 | else |
335 | put_it_in( buffer, index, i18n("am") ); | 372 | put_it_in( buffer, index, i18n("am") ); |
336 | break; | 373 | break; |
337 | } | 374 | } |
338 | default: | 375 | default: |
339 | buffer[index++] = rst.at( format_index ); | 376 | buffer[index++] = rst.at( format_index ); |
340 | break; | 377 | break; |
341 | } | 378 | } |
342 | escape = false; | 379 | escape = false; |
343 | } | 380 | } |
344 | } | 381 | } |
345 | QString ret( buffer, index ); | 382 | QString ret( buffer, index ); |
346 | delete [] buffer; | 383 | delete [] buffer; |
347 | return ret; | 384 | return ret; |
348 | } | 385 | } |
349 | 386 | ||
350 | QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const | 387 | QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const |
351 | { | 388 | { |
352 | const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat); | 389 | const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat); |
353 | 390 | ||
354 | // I'm rather safe than sorry | 391 | // I'm rather safe than sorry |
355 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 50]; | 392 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 50]; |
356 | 393 | ||
357 | unsigned int index = 0; | 394 | unsigned int index = 0; |
358 | bool escape = false; | 395 | bool escape = false; |
359 | int number = 0; | 396 | int number = 0; |
360 | 397 | ||
361 | for ( uint format_index = 0; format_index < rst.length(); ++format_index ) | 398 | for ( uint format_index = 0; format_index < rst.length(); ++format_index ) |
362 | { | 399 | { |
363 | if ( !escape ) | 400 | if ( !escape ) |
364 | { | 401 | { |
365 | if ( rst.at( format_index ).unicode() == '%' ) | 402 | if ( rst.at( format_index ).unicode() == '%' ) |
366 | escape = true; | 403 | escape = true; |
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h index 14660d6..58e0b39 100644 --- a/microkde/kdecore/klocale.h +++ b/microkde/kdecore/klocale.h | |||
@@ -1,119 +1,119 @@ | |||
1 | #ifndef MINIKDE_KLOCALE_H | 1 | #ifndef MINIKDE_KLOCALE_H |
2 | #define MINIKDE_KLOCALE_H | 2 | #define MINIKDE_KLOCALE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qdatetime.h> | 6 | #include <qdatetime.h> |
7 | #include <qdict.h> | 7 | #include <qdict.h> |
8 | 8 | ||
9 | #ifndef I18N_NOOP | 9 | #ifndef I18N_NOOP |
10 | #define I18N_NOOP(x) (x) | 10 | #define I18N_NOOP(x) (x) |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | class KCalendarSystem; | 13 | class KCalendarSystem; |
14 | void setLocaleDict( QDict<QString> * dict ); | 14 | void setLocaleDict( QDict<QString> * dict ); |
15 | QString i18n(const char *text); | 15 | QString i18n(const char *text); |
16 | QString i18n(const char *hint, const char *text); | 16 | QString i18n(const char *hint, const char *text); |
17 | QString i18n(const char *text1, const char *textn, int num); | 17 | QString i18n(const char *text1, const char *textn, int num); |
18 | 18 | ||
19 | // Qt3's uic generates i18n( "msg", "comment" ) calls which conflict | 19 | // Qt3's uic generates i18n( "msg", "comment" ) calls which conflict |
20 | // with our i18n method. we use uic -tr tr2i18n to redirect | 20 | // with our i18n method. we use uic -tr tr2i18n to redirect |
21 | // to the right i18n() function | 21 | // to the right i18n() function |
22 | inline QString tr2i18n(const char* message, const char* =0) { | 22 | inline QString tr2i18n(const char* message, const char* =0) { |
23 | return i18n( message); | 23 | return i18n( message); |
24 | } | 24 | } |
25 | 25 | ||
26 | class KLocale | 26 | class KLocale |
27 | { | 27 | { |
28 | public: | 28 | public: |
29 | KLocale(); | 29 | KLocale(); |
30 | 30 | ||
31 | QString formatNumber(double num, int precision = -1) const; | 31 | QString formatNumber(double num, int precision = -1) const; |
32 | QString formatNumber(const QString &numStr) const; | 32 | QString formatNumber(const QString &numStr) const; |
33 | double readNumber(const QString &numStr, bool * ok = 0) const; | 33 | double readNumber(const QString &numStr, bool * ok = 0) const; |
34 | 34 | ||
35 | QString decimalSymbol() const; | 35 | QString decimalSymbol() const; |
36 | QString thousandsSeparator() const; | 36 | QString thousandsSeparator() const; |
37 | QString positiveSign() const; | 37 | QString positiveSign() const; |
38 | QString negativeSign() const; | 38 | QString negativeSign() const; |
39 | 39 | ||
40 | 40 | ||
41 | QString translate( const char *index ) const; | 41 | QString translate( const char *index ) const; |
42 | QString translate( const char *index, const char *fallback) const; | 42 | QString translate( const char *index, const char *fallback) const; |
43 | 43 | ||
44 | enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 }; | 44 | enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 }; |
45 | 45 | ||
46 | QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const; | 46 | QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const; |
47 | QString formatTime(const QTime &pTime, bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const; | 47 | QString formatTime(const QTime &pTime, bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const; |
48 | QString formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat = Undefined) const; | 48 | QString formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat = Undefined) const; |
49 | QString formatDateTime(const QDateTime &pDateTime, | 49 | QString formatDateTime(const QDateTime &pDateTime, |
50 | bool shortFormat, | 50 | bool shortFormat, |
51 | bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const; | 51 | bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const; |
52 | 52 | ||
53 | QDate readDate(const QString &str, bool* ok = 0) const; | 53 | QDate readDate(const QString &str, bool* ok = 0) const; |
54 | QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const; | 54 | QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const; |
55 | QTime readTime(const QString &str, bool* ok = 0) const; | 55 | QTime readTime(const QString &str, bool* ok = 0) const; |
56 | QDate readDate(const QString &intstr, IntDateFormat intIntDateFormat, bool* ok) const; | 56 | QDate readDate(const QString &intstr, IntDateFormat intIntDateFormat, bool* ok) const; |
57 | 57 | ||
58 | QDateTime readDateTime(const QString &intstr, IntDateFormat intIntDateFormat, bool* ok) const; | 58 | QDateTime readDateTime(const QString &intstr, IntDateFormat intIntDateFormat, bool* ok) const; |
59 | 59 | ||
60 | bool use12Clock() const; | 60 | bool use12Clock() const; |
61 | bool weekStartsMonday() const; | 61 | bool weekStartsMonday() const; |
62 | int weekStartDay() const; | 62 | int weekStartDay() const; |
63 | 63 | ||
64 | QString weekDayName(int,bool=false) const; | 64 | QString weekDayName(int,bool=false) const; |
65 | QString monthName(int,bool=false) const; | 65 | QString monthName(int,bool=false) const; |
66 | 66 | ||
67 | QString country() const; | 67 | QString country() const; |
68 | 68 | int weekNum ( const QDate & ); | |
69 | QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const; | 69 | QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const; |
70 | QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const; | 70 | QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const; |
71 | QString timeFormat(IntDateFormat intIntDateFormat = Undefined) const; | 71 | QString timeFormat(IntDateFormat intIntDateFormat = Undefined) const; |
72 | 72 | ||
73 | void insertCatalogue ( const QString & ); | 73 | void insertCatalogue ( const QString & ); |
74 | 74 | ||
75 | KCalendarSystem *calendar(); | 75 | KCalendarSystem *calendar(); |
76 | void setHore24Format ( bool ); | 76 | void setHore24Format ( bool ); |
77 | void setWeekStartMonday( bool ); | 77 | void setWeekStartMonday( bool ); |
78 | void setIntDateFormat( IntDateFormat ); | 78 | void setIntDateFormat( IntDateFormat ); |
79 | void setIntTimeFormat( IntDateFormat ); | 79 | void setIntTimeFormat( IntDateFormat ); |
80 | IntDateFormat getIntDateFormat( ); | 80 | IntDateFormat getIntDateFormat( ); |
81 | IntDateFormat getIntTimeFormat( ); | 81 | IntDateFormat getIntTimeFormat( ); |
82 | void setLanguage( int ); | 82 | void setLanguage( int ); |
83 | int language(); | 83 | int language(); |
84 | void setDateFormat( QString ); | 84 | void setDateFormat( QString ); |
85 | void setDateFormatShort( QString ); | 85 | void setDateFormatShort( QString ); |
86 | 86 | ||
87 | QString m_decimalSymbol; | 87 | QString m_decimalSymbol; |
88 | QString m_thousandsSeparator; | 88 | QString m_thousandsSeparator; |
89 | QString m_currencySymbol; | 89 | QString m_currencySymbol; |
90 | QString m_monetaryDecimalSymbol; | 90 | QString m_monetaryDecimalSymbol; |
91 | QString m_monetaryThousandsSeparator; | 91 | QString m_monetaryThousandsSeparator; |
92 | QString m_positiveSign; | 92 | QString m_positiveSign; |
93 | QString m_negativeSign; | 93 | QString m_negativeSign; |
94 | 94 | ||
95 | int timezoneOffset( QString ); | 95 | int timezoneOffset( QString ); |
96 | QStringList timeZoneList() const; | 96 | QStringList timeZoneList() const; |
97 | void setDaylightSaving( bool, int , int ); | 97 | void setDaylightSaving( bool, int , int ); |
98 | int localTimeOffset(const QDateTime &); | 98 | int localTimeOffset(const QDateTime &); |
99 | void setTimezone( const QString &timeZone , bool oddTZ); | 99 | void setTimezone( const QString &timeZone , bool oddTZ); |
100 | private: | 100 | private: |
101 | QTime readTime(const QString &str, bool seconds, bool *ok) const; | 101 | QTime readTime(const QString &str, bool seconds, bool *ok) const; |
102 | QDate readDate(const QString &str, bool shortFormat, bool *ok) const; | 102 | QDate readDate(const QString &str, bool shortFormat, bool *ok) const; |
103 | KCalendarSystem *mCalendarSystem; | 103 | KCalendarSystem *mCalendarSystem; |
104 | bool mWeekStartsMonday; | 104 | bool mWeekStartsMonday; |
105 | bool mHourF24Format; | 105 | bool mHourF24Format; |
106 | IntDateFormat mIntDateFormat; | 106 | IntDateFormat mIntDateFormat; |
107 | IntDateFormat mIntTimeFormat; | 107 | IntDateFormat mIntTimeFormat; |
108 | int mLanguage; | 108 | int mLanguage; |
109 | QString mDateFormat; | 109 | QString mDateFormat; |
110 | QString mDateFormatShort; | 110 | QString mDateFormatShort; |
111 | QStringList mTimeZoneList; | 111 | QStringList mTimeZoneList; |
112 | bool daylightEnabled; | 112 | bool daylightEnabled; |
113 | int mDaylightTZoffset; | 113 | int mDaylightTZoffset; |
114 | int mNondaylightTZoffset; | 114 | int mNondaylightTZoffset; |
115 | bool mSouthDaylight; | 115 | bool mSouthDaylight; |
116 | int daylightStart, daylightEnd, mTimeZoneOffset; | 116 | int daylightStart, daylightEnd, mTimeZoneOffset; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #endif | 119 | #endif |