summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/datebook
Unidiff
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 @@
1Makefile* 1Makefile*
2datebookpluginconfigbase*
2moc* 3moc*
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 @@
1 config TODAY_DATEBOOK 1 config TODAY_DATEBOOK
2 boolean "opie-today-datebookplugin (datebook plugin)" 2 boolean "datebook"
3 default "y" 3 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
20 20
21TRANSLATIONS = ../../../../../i18n/de/libtodaydatebookplugin.ts \
22 ../../../../../i18n/nl/libtodaydatebookplugin.ts \
23 ../../../../../i18n/xx/libtodaydatebookplugin.ts \
24 ../../../../../i18n/en/libtodaydatebookplugin.ts \
25 ../../../../../i18n/es/libtodaydatebookplugin.ts \
26 ../../../../../i18n/fr/libtodaydatebookplugin.ts \
27 ../../../../../i18n/hu/libtodaydatebookplugin.ts \
28 ../../../../../i18n/ja/libtodaydatebookplugin.ts \
29 ../../../../../i18n/ko/libtodaydatebookplugin.ts \
30 ../../../../../i18n/no/libtodaydatebookplugin.ts \
31 ../../../../../i18n/pl/libtodaydatebookplugin.ts \
32 ../../../../../i18n/pt/libtodaydatebookplugin.ts \
33 ../../../../../i18n/pt_BR/libtodaydatebookplugin.ts \
34 ../../../../../i18n/sl/libtodaydatebookplugin.ts \
35 ../../../../../i18n/zh_CN/libtodaydatebookplugin.ts \
36 ../../../../../i18n/zh_TW/libtodaydatebookplugin.ts \
37 ../../../../../i18n/it/libtodaydatebookplugin.ts \
38 ../../../../../i18n/da/libtodaydatebookplugin.ts
39
21include ( $(OPIEDIR)/include.pro ) 40include ( $(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 @@
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
@@ -21,2 +21,3 @@
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/calendar.h>
22 23
@@ -30,2 +31,3 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
30 bool show_notes, 31 bool show_notes,
32 bool timeExtraLine,
31 int maxCharClip, 33 int maxCharClip,
@@ -54,13 +56,21 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
54 56
57 QString timeSpacer = " ";
58 if ( timeExtraLine ) {
59 timeSpacer = "<br>";
60 }
61
55 if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) 62 if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" )
56 && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { 63 && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) {
57 msg += "<br>All day"; 64 msg += tr ( "All day" );
58 } else { 65 } else {
59 // start time of event 66 // start time of event
60 QDate tempDate = (ev).event().start().date(); 67// QDate tempDate = (ev).event().start().date();
61 msg += "<br>" 68 msg += timeSpacer;
62 + ampmTime( QTime( (ev).event().start().time() ) ) 69 msg += ampmTime( QTime( (ev).event().start().time() ) )
63 // end time of event 70 // end time of event
64 + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ) 71 + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) );
65 + differDate( tempDate ); 72 }
73
74 if ( (ev).date() != QDate::currentDate() ) {
75 msg += differDate( (ev).date() /* tempDate*/ );
66 } 76 }
@@ -103,14 +113,14 @@ QString DateBookEvent::ampmTime( QTime tm ) {
103QString DateBookEvent::differDate( QDate date ) { 113QString DateBookEvent::differDate( QDate date ) {
104 QDate currentDate = QDate::currentDate(); 114// QDate currentDate = QDate::currentDate();
105 QString returnText = "<font color = #407DD9><b> "; 115 QString returnText = "<font color = #407DD9><b> ";
106 int differDate = currentDate.daysTo( date ); 116// int differDate = currentDate.daysTo( date );
107 if ( currentDate.dayOfWeek() == date.dayOfWeek() ) { 117// if ( currentDate.dayOfWeek() == date.dayOfWeek() ) {
108 returnText += "" ; 118// returnText += "" ;
109 // not working right for recurring events 119// // not working right for recurring events
110 //} else if ( differDate == 1 ) { 120// //} else if ( differDate == 1 ) {
111 //returnText += tr( "tomorrow" ); 121// //returnText += tr( "tomorrow" );
112 } else { 122// } else {
113 //returnText += tr( "in %1 days" ).arg( differDate ); 123// returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] ";
114 returnText += " [ " + date.dayName( date.dayOfWeek() ) + " ] "; 124// }
115 } 125 returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] ";
116 returnText += "</b></font>"; 126 returnText += "</b></font>";
@@ -128,3 +138,3 @@ void DateBookEvent::editEventSlot( const Event &e ) {
128 } else { 138 } else {
129 QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); 139 QCopEnvelope env( "QPE/Application/datebook", "editEvent(int)" );
130 env << e.uid(); 140 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 @@
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
@@ -32,2 +32,3 @@ public:
32 bool show_notes = 0, 32 bool show_notes = 0,
33 bool timeExtraLine = 0,
33 int maxCharClip = 0, 34 int maxCharClip = 0,
@@ -36,2 +37,3 @@ public:
36 ~DateBookEvent(); 37 ~DateBookEvent();
38
37 signals: 39 signals:
@@ -42,2 +44,3 @@ private slots:
42 void editMe(); 44 void editMe();
45
43 private: 46 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() {
71} 71}
72
73void DatebookPlugin::reinitialize() {
74 if ( m_widget ) {
75 m_widget->reinitialize();
76 }
77}
78
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:
41 void refresh(); 41 void refresh();
42 void reinitialize();
42 43
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 )
32 32
33 if ( db ) {
34 delete db;
35 }
36 db = new DateBookDB;
37
38 if ( m_layoutDates ) { 33 if ( m_layoutDates ) {
@@ -47,3 +42,2 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
47 getDates(); 42 getDates();
48 m_layoutDates->addStretch(5);
49} 43}
@@ -64,2 +58,8 @@ void DatebookPluginWidget::readConfig() {
64 m_moreDays = cfg.readNumEntry( "moredays", 0 ); 58 m_moreDays = cfg.readNumEntry( "moredays", 0 );
59 m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 );
60}
61
62void DatebookPluginWidget::reinitialize() {
63 readConfig();
64 refresh();
65} 65}
@@ -76,3 +76,2 @@ void DatebookPluginWidget::refresh() {
76 getDates(); 76 getDates();
77 m_layoutDates->addStretch(5);
78} 77}
@@ -84,2 +83,8 @@ void DatebookPluginWidget::getDates() {
84 83
84
85 if ( db ) {
86 delete db;
87 }
88 db = new DateBookDB;
89
85 QDate date = QDate::currentDate(); 90 QDate date = QDate::currentDate();
@@ -96,10 +101,3 @@ void DatebookPluginWidget::getDates() {
96 count++; 101 count++;
97 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); 102 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
98 m_eventsList.append( l );
99 l->show();
100 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
101 } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) {
102 count++;
103 // show only later appointments
104 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
105 m_eventsList.append( l ); 103 m_eventsList.append( l );
@@ -107,3 +105,23 @@ void DatebookPluginWidget::getDates() {
107 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 105 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
108 } 106 } else {
107 if ( ( QDateTime::currentDateTime() <= (*it).event().end() )
108 // Show events which span over many days and are not elapsed.
109 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) )
110 // Show repeated event for today that is not elapsed.
111 || ( ( (*it).event().repeatType() != Event::NoRepeat )
112 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() )
113 && ( QTime::currentTime() < (*it).event().start().time() ) ) )
114 // Show repeated event for next days.
115 || ( ( (*it).event().repeatType() != Event::NoRepeat )
116 && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) )
117 )
118 {
119 count++;
120 // show only later appointments
121 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
122 m_eventsList.append( l );
123 l->show();
124 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
125 }
126 }
109 } 127 }
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:
36 void refresh(); 36 void refresh();
37 void reinitialize();
37 38
@@ -54,3 +55,4 @@ private:
54 int m_moreDays; 55 int m_moreDays;
55 56 // true if time of an appointment should be an extra line
57 bool m_timeExtraLine;
56}; 58};