Diffstat (limited to 'core/pim/today/plugins/datebook') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/plugins/datebook/.cvsignore | 1 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/config.in | 2 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebook.pro | 19 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookevent.cpp | 48 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookevent.h | 5 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.cpp | 7 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.h | 1 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.cpp | 50 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.h | 4 |
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,3 +1,3 @@ config TODAY_DATEBOOK - boolean "opie-today-datebookplugin (datebook plugin)" + boolean "datebook" default "y" 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 @@ -20,2 +20,21 @@ 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 @@ -3,3 +3,3 @@ * - * copyright : (c) 2002 by Maximilian Reiß + * copyright : (c) 2002, 2003 by Maximilian Reiß * email : harlekin@handhelds.org @@ -21,2 +21,3 @@ #include <qpe/qpeapplication.h> +#include <qpe/calendar.h> @@ -30,2 +31,3 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, bool show_notes, + bool timeExtraLine, int maxCharClip, @@ -54,13 +56,21 @@ 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*/ ); } @@ -103,14 +113,14 @@ 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>"; @@ -128,3 +138,3 @@ void DateBookEvent::editEventSlot( const Event &e ) { } 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 @@ -3,3 +3,3 @@ * - * copyright : (c) 2002 by Maximilian Reiß + * copyright : (c) 2002, 2003 by Maximilian Reiß * email : harlekin@handhelds.org @@ -32,2 +32,3 @@ public: bool show_notes = 0, + bool timeExtraLine = 0, int maxCharClip = 0, @@ -36,2 +37,3 @@ public: ~DateBookEvent(); + signals: @@ -42,2 +44,3 @@ private slots: 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 @@ -71 +71,8 @@ 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 @@ -41,2 +41,3 @@ public: void refresh(); + void reinitialize(); 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 @@ -32,7 +32,2 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) - if ( db ) { - delete db; - } - db = new DateBookDB; - if ( m_layoutDates ) { @@ -47,3 +42,2 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) getDates(); - m_layoutDates->addStretch(5); } @@ -64,2 +58,8 @@ void DatebookPluginWidget::readConfig() { m_moreDays = cfg.readNumEntry( "moredays", 0 ); + m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); +} + +void DatebookPluginWidget::reinitialize() { + readConfig(); + refresh(); } @@ -76,3 +76,2 @@ void DatebookPluginWidget::refresh() { getDates(); - m_layoutDates->addStretch(5); } @@ -84,2 +83,8 @@ void DatebookPluginWidget::getDates() { + + if ( db ) { + delete db; + } + db = new DateBookDB; + QDate date = QDate::currentDate(); @@ -96,10 +101,3 @@ void DatebookPluginWidget::getDates() { 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 ); @@ -107,3 +105,23 @@ void DatebookPluginWidget::getDates() { 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 @@ -36,2 +36,3 @@ public: void refresh(); + void reinitialize(); @@ -54,3 +55,4 @@ private: int m_moreDays; - + // true if time of an appointment should be an extra line + bool m_timeExtraLine; }; |