From 79fcbf52d267aa3eb839de35f15992bf5e18f8eb Mon Sep 17 00:00:00 2001 From: umopapisdn Date: Sat, 12 Apr 2003 00:29:05 +0000 Subject: Bugfix: (bug #0000811) Events are now always atleast 12 pixels high in dayview. --- diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index af98e06..db4c2fd 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp @@ -593,61 +593,61 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, // where = strCat.find( "<", where ); // } - QString strNote = ev.notes(); - where = strNote.find( "<" ); - while ( where != -1 ) { - strNote.remove( where, 1 ); - strNote.insert( where, "<" ); - where = strNote.find( "<", where ); - } + QString strNote = ev.notes(); + where = strNote.find( "<" ); + while ( where != -1 ) { + strNote.remove( where, 1 ); + strNote.insert( where, "<" ); + where = strNote.find( "<", where ); + } - text = "" + strDesc + "
" + ""; - if ( !strCat.isEmpty() ) { - text += strCat + "
"; - } - if (ev.event().type() == Event::Normal ) - setEventText( text ); - else - setAllDayText( text ); + text = "" + strDesc + "
" + ""; + if ( !strCat.isEmpty() ) { + text += strCat + "
"; + } + if (ev.event().type() == Event::Normal ) + setEventText( text ); + else + setAllDayText( text ); text += "

" + 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; - int rh = dateBook->dayView()->rowHeight(0); - y = y*rh/60; - h = h*rh/60; - if ( h < 3 ) { - h = 3; - } - geom.setY( y ); - geom.setHeight( h ); - geom.setX( 0 ); - geom.setWidth(dateBook->dayView()->columnWidth(0)-1); + QTime start = ev.start(); + QTime end = ev.end(); + int y = start.hour()*60+start.minute(); + int h = end.hour()*60+end.minute()-y; + int rh = dateBook->dayView()->rowHeight(0); + y = y*rh/60; + h = h*rh/60; + + if ( h < 12 ) h = 12; // Make sure the widget is no smaller than 12 pixels high, so that it's possible to read atleast the first line. + if ( y > ((24*rh)-12) ) y=(24*rh)-12; // Make sure the widget fits inside the dayview. + geom.setY( y ); + geom.setHeight( h ); + geom.setX( 0 ); + geom.setWidth(dateBook->dayView()->columnWidth(0)-1); } void DateBookDayWidget::setAllDayText( QString &text ) { - text += "" + tr("This is an all day event.") + "
"; + text += "" + tr("This is an all day event.") + ""; } void DateBookDayWidget::setEventText( QString& text ) { - bool whichClock = dateBook->dayView()->whichClock(); - if ( ev.startDate() != ev.endDate() ) { - text += "" + tr("Start") + ": "; - text += TimeString::timeString( ev.event().start().time(), whichClock, FALSE ); - text += " - " + TimeString::longDateString( ev.startDate() ) + "
"; - text += "" + tr("End") + ": "; - text += TimeString::timeString( ev.event().end().time(), whichClock, FALSE ); - text += " - " + TimeString::longDateString( ev.endDate() ) + "
"; - } else { - text += "" + tr("Time") + ": "; - text += TimeString::timeString( ev.start(), whichClock, FALSE ); - text += "" + tr(" - ") + ""; - text += TimeString::timeString( ev.end(), whichClock, FALSE ); - } + bool whichClock = dateBook->dayView()->whichClock(); + if ( ev.startDate() != ev.endDate() ) { + text += "" + tr("Start") + ": "; + text += TimeString::timeString( ev.event().start().time(), whichClock, FALSE ); + text += " - " + TimeString::longDateString( ev.startDate() ) + "
"; + text += "" + tr("End") + ": "; + text += TimeString::timeString( ev.event().end().time(), whichClock, FALSE ); + text += " - " + TimeString::longDateString( ev.endDate() ); + } else { + text += "" + tr("Time") + ": "; + text += TimeString::timeString( ev.start(), whichClock, FALSE ); + text += "" + tr(" - ") + ""; + text += TimeString::timeString( ev.end(), whichClock, FALSE ); + } } DateBookDayWidget::~DateBookDayWidget() -- cgit v0.9.0.2