author | umopapisdn <umopapisdn> | 2003-04-12 00:29:05 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-04-12 00:29:05 (UTC) |
commit | 79fcbf52d267aa3eb839de35f15992bf5e18f8eb (patch) (side-by-side diff) | |
tree | 5e3e1432654d3c97849356e96a1fc4c538a71118 | |
parent | 59e2de381eebb33238ee1b257736a9ae0afdbb7e (diff) | |
download | opie-79fcbf52d267aa3eb839de35f15992bf5e18f8eb.zip opie-79fcbf52d267aa3eb839de35f15992bf5e18f8eb.tar.gz opie-79fcbf52d267aa3eb839de35f15992bf5e18f8eb.tar.bz2 |
Bugfix: (bug #0000811) Events are now always atleast 12 pixels high in dayview.
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
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 @@ -564,119 +564,119 @@ void DateBookDay::keyPressEvent(QKeyEvent *e) e->ignore(); } } //=========================================================================== DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ) : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) { // 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 ) { strDesc.remove( where, 1 ); strDesc.insert( where, "<" ); where = strDesc.find( "<", where ); } QString strCat; // ### Fix later... // QString strCat = ev.category(); // where = strCat.find( "<" ); // while ( where != -1 ) { // strCat.remove( where, 1 ); // strCat.insert( where, "<" ); // 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 = "<b>" + strDesc + "</b><br>" + "<i>"; - if ( !strCat.isEmpty() ) { - text += strCat + "</i><br>"; - } - if (ev.event().type() == Event::Normal ) - setEventText( text ); - else - setAllDayText( text ); + text = "<b>" + strDesc + "</b><br>" + "<i>"; + if ( !strCat.isEmpty() ) { + text += strCat + "</i><br>"; + } + if (ev.event().type() == Event::Normal ) + setEventText( text ); + else + setAllDayText( text ); 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; - 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 += "<b>" + tr("This is an all day event.") + "</b><br>"; + text += "<b>" + tr("This is an all day event.") + "</b>"; } void DateBookDayWidget::setEventText( QString& text ) { - bool whichClock = dateBook->dayView()->whichClock(); - if ( ev.startDate() != ev.endDate() ) { - text += "<b>" + tr("Start") + "</b>: "; - text += TimeString::timeString( ev.event().start().time(), whichClock, FALSE ); - text += " - " + TimeString::longDateString( ev.startDate() ) + "<br>"; - text += "<b>" + tr("End") + "</b>: "; - text += TimeString::timeString( ev.event().end().time(), whichClock, FALSE ); - text += " - " + TimeString::longDateString( ev.endDate() ) + "<br>"; - } else { - text += "<b>" + tr("Time") + "</b>: "; - text += TimeString::timeString( ev.start(), whichClock, FALSE ); - text += "<b>" + tr(" - ") + "</b>"; - text += TimeString::timeString( ev.end(), whichClock, FALSE ); - } + bool whichClock = dateBook->dayView()->whichClock(); + if ( ev.startDate() != ev.endDate() ) { + text += "<b>" + tr("Start") + "</b>: "; + text += TimeString::timeString( ev.event().start().time(), whichClock, FALSE ); + text += " - " + TimeString::longDateString( ev.startDate() ) + "<br>"; + text += "<b>" + tr("End") + "</b>: "; + text += TimeString::timeString( ev.event().end().time(), whichClock, FALSE ); + text += " - " + TimeString::longDateString( ev.endDate() ); + } else { + text += "<b>" + tr("Time") + "</b>: "; + text += TimeString::timeString( ev.start(), whichClock, FALSE ); + text += "<b>" + tr(" - ") + "</b>"; + text += TimeString::timeString( ev.end(), whichClock, FALSE ); + } } DateBookDayWidget::~DateBookDayWidget() { } void DateBookDayWidget::paintEvent( QPaintEvent *e ) { QPainter p( this ); if (dateBook->getSelectedWidget() == this) { p.setBrush( QColor( 155, 240, 230 ) ); // selected item } else { if (dateBook->date() == QDate::currentDate()) { QTime curTime = QTime::currentTime(); if (ev.end() < curTime) { p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive } else { //change color in dependence of the time till the event starts int duration = curTime.secsTo(ev.start()); if (duration < 0) duration = 0; int colChange = duration*160/86400; //86400: secs per day, 160: max color shift p.setBrush( QColor( 200-colChange, 200-colChange, 255 ) ); //blue } } else |