summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookday.cpp
authorzecke <zecke>2002-06-25 19:55:53 (UTC)
committer zecke <zecke>2002-06-25 19:55:53 (UTC)
commitaf4a3940dd672423da28b54e5d955cc5d33cecda (patch) (side-by-side diff)
treecb5fcfe4835c86353e9d54b1050c7dfb23898bf1 /core/pim/datebook/datebookday.cpp
parent8635f264c15b05152fc1a44f798c154472a4b227 (diff)
downloadopie-af4a3940dd672423da28b54e5d955cc5d33cecda.zip
opie-af4a3940dd672423da28b54e5d955cc5d33cecda.tar.gz
opie-af4a3940dd672423da28b54e5d955cc5d33cecda.tar.bz2
All day events are not from 00:00 to 23:59 they're all day now.
Diffstat (limited to 'core/pim/datebook/datebookday.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp52
1 files changed, 32 insertions, 20 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index 9cc5fcd..5474cfc 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -563,13 +563,13 @@ void DateBookDay::keyPressEvent(QKeyEvent *e)
//===========================================================================
DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e,
DateBookDay *db )
: QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db )
{
- bool whichClock = db->dayView()->whichClock();
+
// why would someone use "<"? Oh well, fix it up...
// I wonder what other things may be messed up...
QString strDesc = ev.description();
int where = strDesc.find( "<" );
while ( where != -1 ) {
@@ -594,33 +594,20 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e,
strNote.remove( where, 1 );
strNote.insert( where, "&#60;" );
where = strNote.find( "<", where );
}
text = "<b>" + strDesc + "</b><br>" + "<i>"
- + strCat + "</i>"
- + "<br><b>" + tr("Start") + "</b>: ";
-
-
- if ( e.startDate() != ev.date() ) {
- // multi-day event. Show start date
- text += TimeString::longDateString( e.startDate() );
- } else {
- // Show start time.
- text += TimeString::timeString( ev.start(), whichClock, FALSE );
- }
+ + strCat + "</i><br>";
+ if (ev.event().type() == Event::Normal )
+ setEventText( text );
+ else
+ setAllDayText( text );
- text += "<br><b>" + tr("End") + "</b>: ";
- if ( e.endDate() != ev.date() ) {
- // multi-day event. Show end date
- text += TimeString::longDateString( e.endDate() );
- } else {
- // Show end time.
- text += TimeString::timeString( ev.end(), whichClock, FALSE );
- }
text += "<br><br>" + strNote;
+
setBackgroundMode( PaletteBase );
QTime start = ev.start();
QTime end = ev.end();
int y = start.hour()*60+start.minute();
int h = end.hour()*60+end.minute()-y;
@@ -632,12 +619,36 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e,
geom.setY( y );
geom.setHeight( h );
geom.setX( 0 );
geom.setWidth(dateBook->dayView()->columnWidth(0)-1);
}
+void DateBookDayWidget::setAllDayText( QString &text ) {
+ text += "<b>" + tr("This is an all day event.") + "</b><br>";
+}
+void DateBookDayWidget::setEventText( QString& text ) {
+ bool whichClock = dateBook->dayView()->whichClock();
+ text += "<b>" + tr("Start") + "</b>: ";
+ if ( ev.startDate() != ev.date() ) {
+ // multi-day event. Show start date
+ text += TimeString::longDateString( ev.startDate() );
+ } else {
+ // Show start time.
+ text += TimeString::timeString( ev.start(), whichClock, FALSE );
+ }
+
+ text += "<br><b>" + tr("End") + "</b>: ";
+ if ( ev.endDate() != ev.date() ) {
+ // multi-day event. Show end date
+ text += TimeString::longDateString( ev.endDate() );
+ } else {
+ // Show end time.
+ text += TimeString::timeString( ev.end(), whichClock, FALSE );
+ }
+
+}
DateBookDayWidget::~DateBookDayWidget()
{
}
void DateBookDayWidget::paintEvent( QPaintEvent *e )
@@ -686,12 +697,13 @@ void DateBookDayWidget::paintEvent( QPaintEvent *e )
d = 20;
}
if ( ev.event().hasRepeat() ) {
p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) );
d = 20;
+ y += 20;
}
QSimpleRichText rt( text, font() );
rt.setWidth( geom.width() - d - 6 );
rt.draw( &p, 7, 0, e->region(), colorGroup() );
}