summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/datebook/datebookevent.cpp
Unidiff
Diffstat (limited to 'core/pim/today/plugins/datebook/datebookevent.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.cpp48
1 files changed, 29 insertions, 19 deletions
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
@@ -1,7 +1,7 @@
1/* 1/*
2 * datebookevent.cpp 2 * datebookevent.cpp
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
6 * 6 *
7 */ 7 */
@@ -19,6 +19,7 @@
19#include <qpe/timestring.h> 19#include <qpe/timestring.h>
20#include <qpe/qcopenvelope_qws.h> 20#include <qpe/qcopenvelope_qws.h>
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/calendar.h>
22 23
23#include <opie/odevice.h> 24#include <opie/odevice.h>
24 25
@@ -28,6 +29,7 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
28 QWidget* parent, 29 QWidget* parent,
29 bool show_location, 30 bool show_location,
30 bool show_notes, 31 bool show_notes,
32 bool timeExtraLine,
31 int maxCharClip, 33 int maxCharClip,
32 const char* name, 34 const char* name,
33 WFlags fl) : 35 WFlags fl) :
@@ -52,17 +54,25 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
52 msg += "<BR><i>" + (ev).location() + "</i>"; 54 msg += "<BR><i>" + (ev).location() + "</i>";
53 } 55 }
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 }
67 77
68 // include possible note or not 78 // include possible note or not
@@ -101,18 +111,18 @@ QString DateBookEvent::ampmTime( QTime tm ) {
101} 111}
102 112
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>";
117 return returnText; 127 return returnText;
118} 128}
@@ -126,7 +136,7 @@ void DateBookEvent::editEventSlot( const Event &e ) {
126 if ( ODevice::inst()->system() == System_Zaurus ) { 136 if ( ODevice::inst()->system() == System_Zaurus ) {
127 QCopEnvelope env( "QPE/Application/datebook", "raise()" ); 137 QCopEnvelope env( "QPE/Application/datebook", "raise()" );
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();
131 } 141 }
132} 142}