author | harlekin <harlekin> | 2002-11-27 14:19:09 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-11-27 14:19:09 (UTC) |
commit | 5f0c90d4b6972c1ad22ba20b45cd1d3f88298099 (patch) (unidiff) | |
tree | 0cd24ab2ff259a76e06d7940b9de03a2b067d57a /core/pim/today/plugins/datebook/datebookevent.cpp | |
parent | a75b95fd9f89fc80e867c0efb5837178cab56cbb (diff) | |
download | opie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.zip opie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.tar.gz opie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.tar.bz2 |
ability to show next days too added
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.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index 0a0d186..8277529 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp | |||
@@ -48,27 +48,30 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
48 | } | 48 | } |
49 | 49 | ||
50 | // include location or not | 50 | // include location or not |
51 | if ( show_location ) { | 51 | if ( show_location ) { |
52 | msg += "<BR><i>" + (ev).location() + "</i>"; | 52 | msg += "<BR><i>" + (ev).location() + "</i>"; |
53 | } | 53 | } |
54 | 54 | ||
55 | if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) | 55 | if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) |
56 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { | 56 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { |
57 | msg += "<br>All day"; | 57 | msg += "<br>All day"; |
58 | } else { | 58 | } else { |
59 | // start time of event | 59 | // start time of event |
60 | msg += "<br>" + ampmTime(QTime( (ev).event().start().time() ) ) | 60 | QDate tempDate = (ev).event().start().date(); |
61 | msg += "<br>" | ||
62 | + ampmTime( QTime( (ev).event().start().time() ) ) | ||
61 | // end time of event | 63 | // end time of event |
62 | + "<b> - </b>" + ampmTime(QTime( (ev).event().end().time() ) ); | 64 | + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ) |
65 | + differDate( tempDate ); | ||
63 | } | 66 | } |
64 | 67 | ||
65 | // include possible note or not | 68 | // include possible note or not |
66 | if ( show_notes ) { | 69 | if ( show_notes ) { |
67 | msg += "<br> <i>note</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); | 70 | msg += "<br> <i>note</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); |
68 | } | 71 | } |
69 | setText( msg ); | 72 | setText( msg ); |
70 | connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); | 73 | connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); |
71 | } | 74 | } |
72 | 75 | ||
73 | 76 | ||
74 | /** | 77 | /** |
@@ -86,24 +89,41 @@ QString DateBookEvent::ampmTime( QTime tm ) { | |||
86 | if ( hour > 12 ) { | 89 | if ( hour > 12 ) { |
87 | hour -= 12; | 90 | hour -= 12; |
88 | } | 91 | } |
89 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 92 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
90 | (tm.hour() >= 12) ? "PM" : "AM" ); | 93 | (tm.hour() >= 12) ? "PM" : "AM" ); |
91 | return s; | 94 | return s; |
92 | } else { | 95 | } else { |
93 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 96 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
94 | return s; | 97 | return s; |
95 | } | 98 | } |
96 | } | 99 | } |
97 | 100 | ||
101 | QString DateBookEvent::differDate( QDate date ) { | ||
102 | QDate currentDate = QDate::currentDate(); | ||
103 | QString returnText = "<font color = #407DD9><b> "; | ||
104 | int differDate = currentDate.daysTo( date ); | ||
105 | if ( currentDate.dayOfWeek() == date.dayOfWeek() ) { | ||
106 | returnText += "" ; | ||
107 | // not working right for recurring events | ||
108 | //} else if ( differDate == 1 ) { | ||
109 | //returnText += tr( "tomorrow" ); | ||
110 | } else { | ||
111 | //returnText += tr( "in %1 days" ).arg( differDate ); | ||
112 | returnText += " [ " + date.dayName( date.dayOfWeek() ) + " ] "; | ||
113 | } | ||
114 | returnText += "</b></font>"; | ||
115 | return returnText; | ||
116 | } | ||
117 | |||
98 | 118 | ||
99 | /** | 119 | /** |
100 | * starts the edit dialog as known from datebook | 120 | * starts the edit dialog as known from datebook |
101 | */ | 121 | */ |
102 | void DateBookEvent::editEventSlot( const Event &e ) { | 122 | void DateBookEvent::editEventSlot( const Event &e ) { |
103 | 123 | ||
104 | if ( ODevice::inst()->system() == System_Zaurus ) { | 124 | if ( ODevice::inst()->system() == System_Zaurus ) { |
105 | QCopEnvelope env( "QPE/Application/datebook", "raise()" ); | 125 | QCopEnvelope env( "QPE/Application/datebook", "raise()" ); |
106 | } else { | 126 | } else { |
107 | QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); | 127 | QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); |
108 | env << e.uid(); | 128 | env << e.uid(); |
109 | } | 129 | } |