author | erik <erik> | 2007-04-23 20:46:34 (UTC) |
---|---|---|
committer | erik <erik> | 2007-04-23 20:46:34 (UTC) |
commit | 34975323367e4a903886cd317b34192f1271a1f2 (patch) (side-by-side diff) | |
tree | 8898d9010cdb89b371e0bccdbf717f87359d8513 /core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp | |
parent | d38e40fe9ee475230425fa83e924c49e5946b87c (diff) | |
download | opie-34975323367e4a903886cd317b34192f1271a1f2.zip opie-34975323367e4a903886cd317b34192f1271a1f2.tar.gz opie-34975323367e4a903886cd317b34192f1271a1f2.tar.bz2 |
Fix for bug 1844. The display of 12hour (AM/PM) time was broken. It was
because the views never bother to check.
This fix incorporates the patch submitted by harlekin. Thanks!
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 @@ -1,46 +1,59 @@ #include "datebookweeklstevent.h"
#include "datebooktypes.h"
#include <opie2/odebug.h>
#include <qpe/ir.h>
#include <qstring.h>
#include <qpopupmenu.h>
-DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
+DateBookWeekLstEvent::DateBookWeekLstEvent(bool ap, const EffectiveEvent &ev, int weeklistviewconfig,
QWidget* parent,
const char* name,
- WFlags fl ) : OClickableLabel(parent,name,fl), event(ev)
+ WFlags fl ) : OClickableLabel(parent,name,fl), event(ev), ampm(ap) {
// old values... lastday = "__|__", middle=" |---", Firstday="00:00",
QString s,start,middle,end,day;
odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl;
- if(weeklistviewconfig==NONE) { // No times displayed.
-// start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
-// middle.sprintf("<--->");
-// end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
-// day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
- } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time.
+ if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. + if ( ampm ) { + int shour = ev.start().hour(); + int smin = ev.start().minute(); + if ( shour >= 12 ) { + if ( shour > 12 ) { + shour -= 12; + } + start.sprintf( "%.2d:%.2d PM", shour, smin ); + day.sprintf("%.2d:%.2d PM",shour,smin); + } else { + if ( shour == 0 ) { + shour = 12; + } + start.sprintf( "%.2d:%.2d AM", shour, smin ); + day.sprintf("%.2d:%.2d AM",shour,smin); + } + } else { start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
+ day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); + } middle.sprintf(" |---");
end.sprintf("__|__");
- day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
} else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times.
start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
middle.sprintf("<--->");
end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
}
if(ev.event().type() == Event::Normal) {
if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event.
s=day;
} else if(ev.startDate()==ev.date()) { // start event.
s=start;
} else if(ev.endDate()==ev.date()) { // end event.
s=end;
} else { // middle day.
s=middle;
|