summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/datebook
Side-by-side diff
Diffstat (limited to 'core/pim/today/plugins/datebook') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/.cvsignore1
-rw-r--r--core/pim/today/plugins/datebook/config.in2
-rw-r--r--core/pim/today/plugins/datebook/datebook.pro19
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.cpp48
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.h5
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp7
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h1
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp50
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.h4
9 files changed, 99 insertions, 38 deletions
diff --git a/core/pim/today/plugins/datebook/.cvsignore b/core/pim/today/plugins/datebook/.cvsignore
index 2888d4a..10cf625 100644
--- a/core/pim/today/plugins/datebook/.cvsignore
+++ b/core/pim/today/plugins/datebook/.cvsignore
@@ -1,2 +1,3 @@
Makefile*
+datebookpluginconfigbase*
moc*
diff --git a/core/pim/today/plugins/datebook/config.in b/core/pim/today/plugins/datebook/config.in
index 621510f..7a14438 100644
--- a/core/pim/today/plugins/datebook/config.in
+++ b/core/pim/today/plugins/datebook/config.in
@@ -1,4 +1,4 @@
config TODAY_DATEBOOK
- boolean "opie-today-datebookplugin (datebook plugin)"
+ boolean "datebook"
default "y"
depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
diff --git a/core/pim/today/plugins/datebook/datebook.pro b/core/pim/today/plugins/datebook/datebook.pro
index bd45f71..1f75964 100644
--- a/core/pim/today/plugins/datebook/datebook.pro
+++ b/core/pim/today/plugins/datebook/datebook.pro
@@ -19,3 +19,22 @@ DESTDIR = $(OPIEDIR)/plugins/today
TARGET = todaydatebookplugin
+TRANSLATIONS = ../../../../../i18n/de/libtodaydatebookplugin.ts \
+ ../../../../../i18n/nl/libtodaydatebookplugin.ts \
+ ../../../../../i18n/xx/libtodaydatebookplugin.ts \
+ ../../../../../i18n/en/libtodaydatebookplugin.ts \
+ ../../../../../i18n/es/libtodaydatebookplugin.ts \
+ ../../../../../i18n/fr/libtodaydatebookplugin.ts \
+ ../../../../../i18n/hu/libtodaydatebookplugin.ts \
+ ../../../../../i18n/ja/libtodaydatebookplugin.ts \
+ ../../../../../i18n/ko/libtodaydatebookplugin.ts \
+ ../../../../../i18n/no/libtodaydatebookplugin.ts \
+ ../../../../../i18n/pl/libtodaydatebookplugin.ts \
+ ../../../../../i18n/pt/libtodaydatebookplugin.ts \
+ ../../../../../i18n/pt_BR/libtodaydatebookplugin.ts \
+ ../../../../../i18n/sl/libtodaydatebookplugin.ts \
+ ../../../../../i18n/zh_CN/libtodaydatebookplugin.ts \
+ ../../../../../i18n/zh_TW/libtodaydatebookplugin.ts \
+ ../../../../../i18n/it/libtodaydatebookplugin.ts \
+ ../../../../../i18n/da/libtodaydatebookplugin.ts
+
include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp
index 3c1e97a..e595047 100644
--- a/core/pim/today/plugins/datebook/datebookevent.cpp
+++ b/core/pim/today/plugins/datebook/datebookevent.cpp
@@ -2,5 +2,5 @@
* datebookevent.cpp
*
- * copyright : (c) 2002 by Maximilian Reiß
+ * copyright : (c) 2002, 2003 by Maximilian Reiß
* email : harlekin@handhelds.org
*
@@ -20,4 +20,5 @@
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
+#include <qpe/calendar.h>
#include <opie/odevice.h>
@@ -29,4 +30,5 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
bool show_location,
bool show_notes,
+ bool timeExtraLine,
int maxCharClip,
const char* name,
@@ -53,15 +55,23 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
}
+ QString timeSpacer = " ";
+ if ( timeExtraLine ) {
+ timeSpacer = "<br>";
+ }
+
if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" )
&& ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) {
- msg += "<br>All day";
+ msg += tr ( "All day" );
} else {
// start time of event
- QDate tempDate = (ev).event().start().date();
- msg += "<br>"
- + ampmTime( QTime( (ev).event().start().time() ) )
+// QDate tempDate = (ev).event().start().date();
+ msg += timeSpacer;
+ msg += ampmTime( QTime( (ev).event().start().time() ) )
// end time of event
- + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) )
- + differDate( tempDate );
+ + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) );
+ }
+
+ if ( (ev).date() != QDate::currentDate() ) {
+ msg += differDate( (ev).date() /* tempDate*/ );
}
@@ -102,16 +112,16 @@ QString DateBookEvent::ampmTime( QTime tm ) {
QString DateBookEvent::differDate( QDate date ) {
- QDate currentDate = QDate::currentDate();
+// QDate currentDate = QDate::currentDate();
QString returnText = "<font color = #407DD9><b> ";
- int differDate = currentDate.daysTo( date );
- if ( currentDate.dayOfWeek() == date.dayOfWeek() ) {
- returnText += "" ;
- // not working right for recurring events
- //} else if ( differDate == 1 ) {
- //returnText += tr( "tomorrow" );
- } else {
- //returnText += tr( "in %1 days" ).arg( differDate );
- returnText += " [ " + date.dayName( date.dayOfWeek() ) + " ] ";
- }
+// int differDate = currentDate.daysTo( date );
+// if ( currentDate.dayOfWeek() == date.dayOfWeek() ) {
+// returnText += "" ;
+// // not working right for recurring events
+// //} else if ( differDate == 1 ) {
+// //returnText += tr( "tomorrow" );
+// } else {
+// returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] ";
+// }
+ returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] ";
returnText += "</b></font>";
return returnText;
@@ -127,5 +137,5 @@ void DateBookEvent::editEventSlot( const Event &e ) {
QCopEnvelope env( "QPE/Application/datebook", "raise()" );
} else {
- QCopEnvelope env( "QPE/Datebook", "editEvent(int)" );
+ QCopEnvelope env( "QPE/Application/datebook", "editEvent(int)" );
env << e.uid();
}
diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h
index 8027809..1a090e3 100644
--- a/core/pim/today/plugins/datebook/datebookevent.h
+++ b/core/pim/today/plugins/datebook/datebookevent.h
@@ -2,5 +2,5 @@
* datebookplugin.h
*
- * copyright : (c) 2002 by Maximilian Reiß
+ * copyright : (c) 2002, 2003 by Maximilian Reiß
* email : harlekin@handhelds.org
*
@@ -31,8 +31,10 @@ public:
bool show_location = 0,
bool show_notes = 0,
+ bool timeExtraLine = 0,
int maxCharClip = 0,
const char* name = 0,
WFlags fl = 0 );
~DateBookEvent();
+
signals:
void editEvent( const Event &e );
@@ -41,4 +43,5 @@ private slots:
void editEventSlot( const Event &e );
void editMe();
+
private:
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
index 4e650ee..f77e440 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.cpp
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -70,2 +70,9 @@ void DatebookPlugin::refresh() {
}
}
+
+void DatebookPlugin::reinitialize() {
+ if ( m_widget ) {
+ m_widget->reinitialize();
+ }
+}
+
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h
index db899e8..890c59b 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.h
+++ b/core/pim/today/plugins/datebook/datebookplugin.h
@@ -40,4 +40,5 @@ public:
bool excludeFromRefresh() const;
void refresh();
+ void reinitialize();
private:
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index 1970654..9e95bcd 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -31,9 +31,4 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
m_layoutDates = 0l;
- if ( db ) {
- delete db;
- }
- db = new DateBookDB;
-
if ( m_layoutDates ) {
delete m_layoutDates;
@@ -46,5 +41,4 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
readConfig();
getDates();
- m_layoutDates->addStretch(5);
}
@@ -63,4 +57,10 @@ void DatebookPluginWidget::readConfig() {
m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
m_moreDays = cfg.readNumEntry( "moredays", 0 );
+ m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 );
+}
+
+void DatebookPluginWidget::reinitialize() {
+ readConfig();
+ refresh();
}
@@ -75,5 +75,4 @@ void DatebookPluginWidget::refresh() {
getDates();
- m_layoutDates->addStretch(5);
}
@@ -83,4 +82,10 @@ void DatebookPluginWidget::refresh() {
void DatebookPluginWidget::getDates() {
+
+ if ( db ) {
+ delete db;
+ }
+ db = new DateBookDB;
+
QDate date = QDate::currentDate();
QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
@@ -95,16 +100,29 @@ void DatebookPluginWidget::getDates() {
if ( !m_onlyLater ) {
count++;
- DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
- m_eventsList.append( l );
- l->show();
- QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
- } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) {
- count++;
- // show only later appointments
- DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
+ DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
m_eventsList.append( l );
l->show();
QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
- }
+ } else {
+ if ( ( QDateTime::currentDateTime() <= (*it).event().end() )
+ // Show events which span over many days and are not elapsed.
+ || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) )
+ // Show repeated event for today that is not elapsed.
+ || ( ( (*it).event().repeatType() != Event::NoRepeat )
+ && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() )
+ && ( QTime::currentTime() < (*it).event().start().time() ) ) )
+ // Show repeated event for next days.
+ || ( ( (*it).event().repeatType() != Event::NoRepeat )
+ && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) )
+ )
+ {
+ count++;
+ // show only later appointments
+ DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
+ m_eventsList.append( l );
+ l->show();
+ QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
+ }
+ }
}
}
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h
index 35d43cd..8988073 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.h
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h
@@ -35,4 +35,5 @@ public:
~DatebookPluginWidget();
void refresh();
+ void reinitialize();
private:
@@ -53,5 +54,6 @@ private:
bool m_onlyLater;
int m_moreDays;
-
+ // true if time of an appointment should be an extra line
+ bool m_timeExtraLine;
};