Diffstat (limited to 'core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp index 797f766..881e8f1 100644 --- a/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp +++ b/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp | |||
@@ -3,36 +3,49 @@ | |||
3 | 3 | ||
4 | #include <opie2/odebug.h> | 4 | #include <opie2/odebug.h> |
5 | 5 | ||
6 | #include <qpe/ir.h> | 6 | #include <qpe/ir.h> |
7 | 7 | ||
8 | #include <qstring.h> | 8 | #include <qstring.h> |
9 | #include <qpopupmenu.h> | 9 | #include <qpopupmenu.h> |
10 | 10 | ||
11 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 11 | DateBookWeekLstEvent::DateBookWeekLstEvent(bool ap, const EffectiveEvent &ev, |
12 | int weeklistviewconfig, | 12 | int weeklistviewconfig, |
13 | QWidget* parent, | 13 | QWidget* parent, |
14 | const char* name, | 14 | const char* name, |
15 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) | 15 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev), ampm(ap) |
16 | { | 16 | { |
17 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", | 17 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", |
18 | QString s,start,middle,end,day; | 18 | QString s,start,middle,end,day; |
19 | 19 | ||
20 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; | 20 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; |
21 | if(weeklistviewconfig==NONE) { // No times displayed. | 21 | if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. |
22 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 22 | if ( ampm ) { |
23 | // middle.sprintf("<--->"); | 23 | int shour = ev.start().hour(); |
24 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 24 | int smin = ev.start().minute(); |
25 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 25 | if ( shour >= 12 ) { |
26 | } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. | 26 | if ( shour > 12 ) { |
27 | shour -= 12; | ||
28 | } | ||
29 | start.sprintf( "%.2d:%.2d PM", shour, smin ); | ||
30 | day.sprintf("%.2d:%.2d PM",shour,smin); | ||
31 | } else { | ||
32 | if ( shour == 0 ) { | ||
33 | shour = 12; | ||
34 | } | ||
35 | start.sprintf( "%.2d:%.2d AM", shour, smin ); | ||
36 | day.sprintf("%.2d:%.2d AM",shour,smin); | ||
37 | } | ||
38 | } else { | ||
27 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 39 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
40 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
41 | } | ||
28 | middle.sprintf(" |---"); | 42 | middle.sprintf(" |---"); |
29 | end.sprintf("__|__"); | 43 | end.sprintf("__|__"); |
30 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
31 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. | 44 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. |
32 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 45 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
33 | middle.sprintf("<--->"); | 46 | middle.sprintf("<--->"); |
34 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 47 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
35 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 48 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
36 | } | 49 | } |
37 | 50 | ||
38 | if(ev.event().type() == Event::Normal) { | 51 | if(ev.event().type() == Event::Normal) { |