summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/TODO2
-rw-r--r--core/pim/today/changelog2
-rw-r--r--core/pim/today/today.cpp186
-rw-r--r--core/pim/today/today.h42
-rw-r--r--core/pim/today/todaybase.cpp24
5 files changed, 155 insertions, 101 deletions
diff --git a/core/pim/today/TODO b/core/pim/today/TODO
index 48e8d20..6acbf5a 100644
--- a/core/pim/today/TODO
+++ b/core/pim/today/TODO
@@ -4,4 +4,2 @@ TODO for today:
-* add am/pm mode instead of 24 h, take system default
-
* qcop integration for updating events?
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index b3da1fb..f04ff78 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -1 +1,3 @@
+* am/pm time optinal (autodetect)
+
0.3.1
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 7cef035..028947d 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -23,3 +23,3 @@
#include <qpe/config.h>
-#include <qpe/qcopenvelope_qws.h>
+#include <qpe/qcopenvelope_qws.h>
#include <qpe/qprocess.h>
@@ -32,3 +32,3 @@
#include <qfile.h>
-#include <qdatetime.h>
+#include <qdatetime.h>
#include <qtextstream.h>
@@ -58,5 +58,5 @@ int NEW_START=1;
-/*
- * Constructs a Example which is a child of 'parent', with the
- * name 'name' and widget flags set to 'f'
+/*
+ * Constructs a Example which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
*/
@@ -68,4 +68,4 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
-
-#if defined(Q_WS_QWS)
+
+#if defined(Q_WS_QWS)
#if !defined(QT_NO_COP)
@@ -76,3 +76,5 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
#endif
-
+
+
+
db = NULL;
@@ -100,3 +102,3 @@ void Today::channelReceived(const QCString &msg, const QByteArray & data) {
* Initialises the owner field with the default value, the username
- */
+ */
void Today::setOwnerField() {
@@ -119,3 +121,3 @@ void Today::setOwnerField(QString &message) {
}
-}
+}
@@ -127,3 +129,3 @@ void Today::autoStart() {
Config cfg("today");
- cfg.setGroup("Autostart");
+ cfg.setGroup("Autostart");
AUTOSTART = cfg.readNumEntry("autostart",1);
@@ -147,3 +149,3 @@ void Today::draw() {
getMail();
-
+
// if the todolist.xml file was not modified in between, do not parse it.
@@ -223,6 +225,6 @@ void Today::startConfig() {
Config cfg("today");
- cfg.setGroup("BaseConfig");
-
+ cfg.setGroup("BaseConfig");
+
//init();
-
+
conf->SpinBox1->setValue(MAX_LINES_MEET);
@@ -242,3 +244,3 @@ void Today::startConfig() {
conf->exec();
-
+
int maxlinestask = conf->SpinBox2->value();
@@ -250,5 +252,5 @@ void Today::startConfig() {
int autostart =conf->CheckBoxAuto->isChecked();
-
+
cfg.writeEntry("maxlinestask",maxlinestask);
- cfg.writeEntry("maxcharclip", maxcharclip);
+ cfg.writeEntry("maxcharclip", maxcharclip);
cfg.writeEntry("maxlinesmeet",maxmeet);
@@ -259,5 +261,5 @@ void Today::startConfig() {
cfg.writeEntry("autostart", autostart);
-
+
// sync it to "disk"
- cfg.write();
+ cfg.write();
NEW_START=1;
@@ -281,3 +283,3 @@ void Today::getDates() {
}
- db = new DateBookDB;
+ db = new DateBookDB;
@@ -291,11 +293,11 @@ void Today::getDates() {
//bool ampm = config.readBoolEntry( "AMPM", TRUE );
-
+
int count=0;
-
+
if ( list.count() > 0 ) {
-
+
for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
it!=list.end(); ++it ) {
-
-
+
+
if ( count <= MAX_LINES_MEET ) {
@@ -303,3 +305,3 @@ void Today::getDates() {
QTime time = QTime::currentTime();
-
+
if (!ONLY_LATER) {
@@ -312,3 +314,3 @@ void Today::getDates() {
count++;
-
+
// show only later appointments
@@ -318,3 +320,3 @@ void Today::getDates() {
this, SLOT(editEvent(const Event &)));
- }
+ }
}
@@ -325,3 +327,3 @@ void Today::getDates() {
layoutDates->addWidget(noMoreEvents);
- }
+ }
} else {
@@ -331,3 +333,3 @@ void Today::getDates() {
}
-
+
layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
@@ -336,3 +338,3 @@ void Today::getDates() {
}
-
+
@@ -340,4 +342,4 @@ void Today::getMail() {
Config cfg("opiemail");
- cfg.setGroup("today");
-
+ cfg.setGroup("today");
+
// how many lines should be showed in the task section
@@ -345,5 +347,5 @@ void Today::getMail() {
int OUTGOING = cfg.readNumEntry("outgoing",0);
-
+
QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
-
+
MailField->setText(output);
@@ -356,3 +358,3 @@ void Today::getMail() {
void Today::getTodo() {
-
+
QString output;
@@ -372,3 +374,3 @@ void Today::getTodo() {
}
-
+
// get total number of still open todos
@@ -380,3 +382,3 @@ void Today::getTodo() {
count +=1;
- // not the overdues, we allready got them, and not if we are
+ // not the overdues, we allready got them, and not if we are
// over the maxlines
@@ -388,4 +390,4 @@ void Today::getTodo() {
}
-
-
+
+
if (count > 0) {
@@ -400,3 +402,3 @@ void Today::getTodo() {
}
-
+
TodoField->setText(tr(output));
@@ -407,3 +409,3 @@ void Today::getTodo() {
*/
-void Today::startDatebook() {
+void Today::startDatebook() {
QCopEnvelope e("QPE/System", "execute(QString)");
@@ -414,3 +416,3 @@ void Today::startDatebook() {
* starts the edit dialog as known from datebook
- */
+ */
@@ -420,3 +422,3 @@ void Today::editEvent(const Event &e) {
startDatebook();
-
+
while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents();
@@ -428,3 +430,3 @@ void Today::editEvent(const Event &e) {
* launches todolist
- */
+ */
void Today::startTodo() {
@@ -446,18 +448,21 @@ Today::~Today() {
-
-
/*
- * Gets the events for the current day, if it should get all dates
+ * Gets the events for the current day, if it should get all dates
*/
-DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
- QWidget* parent = 0,
+DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
+ QWidget* parent = 0,
int SHOW_LOCATION = 0,
int SHOW_NOTES = 0,
- const char* name = 0,
+ const char* name = 0,
WFlags fl = 0) :
ClickableLabel(parent,name,fl), event(ev) {
-
+
QString msg;
//QTime time = QTime::currentTime();
-
+
+ Config config( "qpe" );
+ // if 24 h format
+ ampm = config.readBoolEntry( "AMPM", TRUE );
+
+
if (!ONLY_LATER) {
@@ -471,3 +476,3 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
}
-
+
if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
@@ -476,7 +481,7 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
// start time of event
- msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) )
+ msg += "<br>" + ampmTime(QTime((ev).event().start().time()) );
// end time of event
- + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) );
+ + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) );
}
-
+
// include possible note or not
@@ -492,13 +497,38 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
-DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
- QWidget* parent = 0,
+QString DateBookEvent::ampmTime(QTime tm) {
+
+ QString s;
+ if( ampm ) {
+ int hour = tm.hour();
+ if (hour == 0)
+ hour = 12;
+ if (hour > 12)
+ hour -= 12;
+ s.sprintf( "%2d:%02d %s", hour, tm.minute(),
+ (tm.hour() >= 12) ? "PM" : "AM" );
+ return s;
+ } else {
+ s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
+ return s;
+ }
+
+}
+
+
+DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
+ QWidget* parent = 0,
int SHOW_LOCATION = 0,
int SHOW_NOTES = 0,
- const char* name = 0,
+ const char* name = 0,
WFlags fl = 0) :
ClickableLabel(parent,name,fl), event(ev) {
-
+
QString msg;
QTime time = QTime::currentTime();
-
+
+ Config config( "qpe" );
+ // if 24 h format
+ ampm = config.readBoolEntry( "AMPM", TRUE );
+
+
if ((time.toString() <= TimeString::dateString((ev).event().end())) ) {
@@ -513,3 +543,3 @@ DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
}
-
+
if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
@@ -518,5 +548,5 @@ DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
// start time of event
- msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) )
+ msg += "<br>" + ampmTime(QTime((ev).event().start().time()) )
// end time of event
- + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) );
+ + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) );
}
@@ -526,4 +556,4 @@ DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
}
- }
-
+ }
+
setText(msg);
@@ -534,2 +564,22 @@ DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
+QString DateBookEventLater::ampmTime(QTime tm) {
+
+ QString s;
+ if( ampm ) {
+ int hour = tm.hour();
+ if (hour == 0)
+ hour = 12;
+ if (hour > 12)
+ hour -= 12;
+ s.sprintf( "%2d:%02d %s", hour, tm.minute(),
+ (tm.hour() >= 12) ? "PM" : "AM" );
+ return s;
+ } else {
+ s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
+ return s;
+ }
+
+}
+
+
void DateBookEvent::editMe() {
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 090e8f9..d265d67 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -29,3 +29,3 @@
#include <qdatetime.h>
-#include <qlist.h>
+#include <qlist.h>
@@ -38,8 +38,8 @@ class QVBoxLayout;
class Today : public TodayBase {
- Q_OBJECT
-
- public:
- Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
- ~Today();
-
+ Q_OBJECT
+
+ public:
+ Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~Today();
+
private slots:
@@ -60,5 +60,5 @@ class Today : public TodayBase {
void setOwnerField(QString &string);
- private slots:
- void channelReceived(const QCString &msg, const QByteArray & data);
-
+ private slots:
+ void channelReceived(const QCString &msg, const QByteArray & data);
+
private:
@@ -72,3 +72,3 @@ class Today : public TodayBase {
int MAX_LINES_MEET;
- int SHOW_LOCATION;
+ int SHOW_LOCATION;
int SHOW_NOTES;
@@ -79,8 +79,8 @@ class DateBookEvent: public ClickableLabel {
public:
- DateBookEvent(const EffectiveEvent &ev,
- QWidget* parent = 0,
- int SHOW_LOCATION = 0,
- int SHOW_NOTES = 0,
- const char* name = 0,
- WFlags fl = 0);
+ DateBookEvent(const EffectiveEvent &ev,
+ QWidget* parent = 0,
+ int SHOW_LOCATION = 0,
+ int SHOW_NOTES = 0,
+ const char* name = 0,
+ WFlags fl = 0);
signals:
@@ -90,3 +90,5 @@ private slots:
private:
+ QString ampmTime(QTime);
const EffectiveEvent event;
+ bool ampm;
};
@@ -96,3 +98,3 @@ class DateBookEventLater: public ClickableLabel {
public:
- DateBookEventLater(const EffectiveEvent &ev,
+ DateBookEventLater(const EffectiveEvent &ev,
QWidget* parent = 0,
@@ -100,3 +102,3 @@ public:
int SHOW_NOTES = 0,
- const char* name = 0,
+ const char* name = 0,
WFlags fl = 0);
@@ -107,3 +109,5 @@ private slots:
private:
+ QString ampmTime(QTime);
const EffectiveEvent event;
+ bool ampm;
};
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index 755c860..ae8763b 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -47,9 +47,9 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
- QPalette pal = this->palette();
- QColor col = pal.color(QPalette::Active, QColorGroup::Background);
- pal.setColor(QPalette::Active, QColorGroup::Button, col);
- pal.setColor(QPalette::Inactive, QColorGroup::Button, col);
- pal.setColor(QPalette::Normal, QColorGroup::Button, col);
- pal.setColor(QPalette::Disabled, QColorGroup::Button, col);
- this->setPalette(pal);
+ //QPalette pal = this->palette();
+ // QColor col = pal.color(QPalette::Active, QColorGroup::Background);
+ //pal.setColor(QPalette::Active, QColorGroup::Button, col);
+ //pal.setColor(QPalette::Inactive, QColorGroup::Button, col);
+ //pal.setColor(QPalette::Normal, QColorGroup::Button, col);
+ //pal.setColor(QPalette::Disabled, QColorGroup::Button, col);
+ //this->setPalette(pal);
@@ -97,3 +97,3 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
Frame4 = new QFrame( this, "Frame4" );
- Frame4->setPalette( pal );
+// Frame4->setPalette( pal );
Frame4->setFrameShape( QScrollView::StyledPanel );
@@ -114,3 +114,3 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin );
- DatesButton->setPalette( pal );
+// DatesButton->setPalette( pal );
DatesButton->setPixmap( datebook );
@@ -130,3 +130,3 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
MailButton->setGeometry( QRect( 2, 3, 36, 19 ) );
- MailButton->setPalette( pal );
+// MailButton->setPalette( pal );
MailButton->setPixmap( mail );
@@ -152,3 +152,3 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) );
- TodoButton->setPalette( pal );
+// TodoButton->setPalette( pal );
TodoButton->setPixmap( todo );
@@ -171,3 +171,3 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
PushButton1->setPixmap( config );
- PushButton1->setPalette( pal );
+// PushButton1->setPalette( pal );
PushButton1->setAutoDefault( TRUE );