summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklst.cpp15
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklst.h1
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp16
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstdblview.h5
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp31
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstevent.h3
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstview.cpp16
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstview.h7
8 files changed, 63 insertions, 31 deletions
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
index b36bf6d..59f937f 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
@@ -12,2 +12,3 @@
#include <qpe/config.h>
+#include <qpe/qpeapplication.h>
@@ -70,3 +71,5 @@ void DateBookWeekLst::setDbl(bool on) {
-void DateBookWeekLst::redraw() {getEvents();}
+void DateBookWeekLst::redraw() {
+ getEvents();
+}
@@ -108,5 +111,5 @@ void DateBookWeekLst::getEvents() {
if (dbl) {
- m_CurrentView=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
+ m_CurrentView=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,ampm,scroll);
} else {
- m_CurrentView=new DateBookWeekLstDblView(el,start,bStartOnMonday,scroll);
+ m_CurrentView=new DateBookWeekLstDblView(el,start,bStartOnMonday,ampm,scroll);
}
@@ -121,2 +124,3 @@ void DateBookWeekLst::getEvents() {
this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
+ connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool)));
scroll->addChild(m_CurrentView);
@@ -132,2 +136,7 @@ void DateBookWeekLst::getEvents() {
+void DateBookWeekLst::slotClockChanged( bool ap ) {
+ ampm = ap;
+ getEvents();
+}
+
void DateBookWeekLst::dateChanged(QDate &newdate) {
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.h b/core/pim/datebook/modules/weeklst/datebookweeklst.h
index 505810b..53bed05 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklst.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklst.h
@@ -37,2 +37,3 @@ protected slots:
void keyPressEvent(QKeyEvent *);
+ void slotClockChanged(bool);
void setDbl(bool on);
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp
index 6389822..5182df1 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp
@@ -7,6 +7,6 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
QValueList<EffectiveEvent> &ev2,
- QDate &d, bool onM,
+ QDate &d, bool onM, bool showAmPm,
QWidget* parent,
const char* name, WFlags fl)
- : QWidget( parent, name, fl )
+ : QWidget( parent, name, fl ), ampm( showAmPm )
{
@@ -20,6 +20,6 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
- QDate &d, bool onM,
+ QDate &d, bool onM, bool showAmPm,
QWidget* parent,
const char* name, WFlags fl)
- : QWidget( parent, name, fl )
+ : QWidget( parent, name, fl ), ampm( showAmPm )
{
@@ -37,3 +37,3 @@ void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QValueLis
if (!leftView) {
- leftView=new DateBookWeekLstView(ev1,d,onM,this);
+ leftView=new DateBookWeekLstView(ev1, d, onM, ampm, this);
m_MainLayout->addWidget(leftView);
@@ -54,3 +54,3 @@ void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QValueLis
if (!rightView) {
- rightView=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
+ rightView=new DateBookWeekLstView(ev2, d.addDays(7), onM, ampm, this);
m_MainLayout->addWidget(rightView);
@@ -77,3 +77,3 @@ void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QDate &d,
if (!leftView) {
- leftView=new DateBookWeekLstView(ev1,d,onM,this);
+ leftView=new DateBookWeekLstView(ev1, d, onM, ampm, this);
m_MainLayout->addWidget(leftView);
@@ -101,3 +101,3 @@ void DateBookWeekLstDblView::setRightEvents(QValueList<EffectiveEvent> &ev1,QDat
if (!rightView) {
- rightView=new DateBookWeekLstView(ev1,d,onM,this);
+ rightView=new DateBookWeekLstView(ev1, d, onM, ampm, this);
m_MainLayout->addWidget(rightView);
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
index 808556e..9eb17e0 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
@@ -18,3 +18,3 @@ public:
QValueList<EffectiveEvent> &ev2,
- QDate &d, bool onM,
+ QDate &d, bool onM, bool showAmPm,
QWidget* parent = 0, const char* name = 0,
@@ -22,3 +22,3 @@ public:
DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
- QDate &d, bool onM,
+ QDate &d, bool onM, bool showAmPm,
QWidget* parent = 0, const char* name = 0,
@@ -45,2 +45,3 @@ protected:
DateBookWeekLstView *leftView,*rightView;
+ bool ampm;
};
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
@@ -10,3 +10,3 @@
-DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
+DateBookWeekLstEvent::DateBookWeekLstEvent(bool ap, const EffectiveEvent &ev,
int weeklistviewconfig,
@@ -14,3 +14,3 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
const char* name,
- WFlags fl ) : OClickableLabel(parent,name,fl), event(ev)
+ WFlags fl ) : OClickableLabel(parent,name,fl), event(ev), ampm(ap)
{
@@ -20,12 +20,25 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
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.
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstevent.h b/core/pim/datebook/modules/weeklst/datebookweeklstevent.h
index 77f6283..1e3cd5d 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstevent.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstevent.h
@@ -11,3 +11,3 @@ class DateBookWeekLstEvent: public Opie::Ui::OClickableLabel
public:
- DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1,
+ DateBookWeekLstEvent(bool ampm, const EffectiveEvent &ev, int weeklistviewconfig =1,
QWidget* parent = 0, const char* name = 0,
@@ -30,2 +30,3 @@ protected:
void mousePressEvent( QMouseEvent *e );
+ bool ampm;
};
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
index 82b9c6d..469a60a 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
@@ -9,2 +9,3 @@
#include <qpe/config.h>
+#include <qpe/qpeapplication.h>
@@ -14,6 +15,6 @@
DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
- const QDate &d, bool onM,
+ const QDate &d, bool onM, bool showAmPm,
QWidget* parent,
const char* name, WFlags fl)
- : QWidget( parent, name, fl )
+ : QWidget( parent, name, fl ), ampm(showAmPm)
{
@@ -73,2 +74,3 @@ void DateBookWeekLstView::setEvents(QValueList<EffectiveEvent> &ev, const QDate
tlayout->addWidget(hdr);
+ connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool)));
@@ -77,3 +79,3 @@ void DateBookWeekLstView::setEvents(QValueList<EffectiveEvent> &ev, const QDate
if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day.
- DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,w);
+ DateBookWeekLstEvent *l=new DateBookWeekLstEvent(ampm,*it,weeklistviewconfig,w);
tlayout->addWidget(l);
@@ -89,6 +91,2 @@ void DateBookWeekLstView::setEvents(QValueList<EffectiveEvent> &ev, const QDate
m_MainLayout->addWidget(w);
-/*
- QSpacerItem * tmp = new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding);
- m_MainLayout->addItem(tmp);
-*/
}
@@ -97,2 +95,6 @@ void DateBookWeekLstView::setEvents(QValueList<EffectiveEvent> &ev, const QDate
+void DateBookWeekLstView::slotClockChanged( bool ap ) {
+ ampm = ap;
+}
+
DateBookWeekLstView::~DateBookWeekLstView()
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.h b/core/pim/datebook/modules/weeklst/datebookweeklstview.h
index 3d47842..900101d 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstview.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.h
@@ -17,3 +17,5 @@ class DateBookWeekLstView: public QWidget
public:
- DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, QWidget* parent = 0, const char* name = 0,
+ DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d,
+ bool onM, bool showAmPm, QWidget* parent = 0,
+ const char* name = 0,
WFlags fl = 0 );
@@ -32,4 +34,6 @@ signals:
const QString &str, const QString &location);
+
protected:
bool bStartOnMonday;
+ bool ampm;
QValueList<QObject*> childs;
@@ -40,2 +44,3 @@ protected slots:
void keyPressEvent(QKeyEvent *);
+ void slotClockChanged( bool ap );
};