author | harlekin <harlekin> | 2003-02-11 22:27:27 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-02-11 22:27:27 (UTC) |
commit | ee67394120b5436d955d64a21b8ea707b57ac0c0 (patch) (side-by-side diff) | |
tree | 7bff77ad9e116ed103068f69aee19671ec8a1680 | |
parent | e7ebea116b82577d861cba0650a80b12900b2e24 (diff) | |
download | opie-ee67394120b5436d955d64a21b8ea707b57ac0c0.zip opie-ee67394120b5436d955d64a21b8ea707b57ac0c0.tar.gz opie-ee67394120b5436d955d64a21b8ea707b57ac0c0.tar.bz2 |
fix for bugreport #664, show also location in popups in datebooks weekview
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index e16f516..ddd41af 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp @@ -420,202 +420,210 @@ void DateBookWeek::setDate( int y, int m, int d ) setDate(QDate(y, m, d)); } void DateBookWeek::setDate(QDate date) { dow = date.dayOfWeek(); int w, y; calcWeek( date, w, y, bStartOnMonday ); header->setDate( y, w ); } void DateBookWeek::dateChanged( int y, int w ) { year = y; _week = w; getEvents(); } QDate DateBookWeek::date() const { QDate d; d = dateFromWeek( _week - 1, year, bStartOnMonday ); if ( bStartOnMonday ) d = d.addDays( 7 + dow - 1 ); else { if ( dow == 7 ) d = d.addDays( dow ); else d = d.addDays( 7 + dow ); } return d; } void DateBookWeek::getEvents() { QDate startWeek = weekDate(); QDate endWeek = startWeek.addDays( 6 ); QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, endWeek); view->showEvents( eventList ); view->moveToHour( startTime ); } void DateBookWeek::generateAllDayTooltext( QString& text ) { text += "<b>" + tr("This is an all day event.") + "</b><br>"; } void DateBookWeek::generateNormalTooltext( QString& str, const EffectiveEvent &ev ) { str += "<b>" + QObject::tr("Start") + "</b>: "; if ( ev.startDate() != ev.date() ) { // multi-day event. Show start date str += TimeString::longDateString( ev.startDate() ); } else { // Show start time. str += TimeString::timeString(ev.start(), ampm, FALSE ); } str += "<br><b>" + QObject::tr("End") + "</b>: "; if ( ev.endDate() != ev.date() ) { // multi-day event. Show end date str += TimeString::longDateString( ev.endDate() ); } else { // Show end time. str += TimeString::timeString( ev.end(), ampm, FALSE ); } } void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) { if ( tHide->isActive() ) tHide->stop(); // 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 strLocation = ev.location(); + while ( where != -1 ) { + strLocation.remove( where, 1 ); + strLocation.insert( where, "<" ); + where = strLocation.find( "<", where ); + } + QString strNote = ev.notes(); where = strNote.find( "<" ); while ( where != -1 ) { strNote.remove( where, 1 ); strNote.insert( where, "<" ); where = strNote.find( "<", where ); } - QString str = "<b>" + strDesc + "</b><br>" + "<i>" - + strCat + "</i>" + QString str = "<b>" + strDesc + "</b><br>" + + strLocation + "<br>" + + "<i>" + strCat + "</i>" + "<br>" + TimeString::longDateString( ev.date() ) + "<br>"; if (ev.event().type() == Event::Normal ) generateNormalTooltext( str, ev ); else generateAllDayTooltext( str ); str += "<br><br>" + strNote; lblDesc->setText( str ); lblDesc->resize( lblDesc->sizeHint() ); // move the label so it is "centerd" horizontally... lblDesc->move( QMAX(0,(width() - lblDesc->width()) / 2), 0 ); lblDesc->show(); } void DateBookWeek::slotHideEvent() { tHide->start( 2000, true ); } void DateBookWeek::setStartViewTime( int startHere ) { startTime = startHere; view->moveToHour( startTime ); } int DateBookWeek::startViewTime() const { return startTime; } void DateBookWeek::redraw() { getEvents(); } void DateBookWeek::slotYearChanged( int y ) { int totWeek; QDate d( y, 12, 31 ); int throwAway; calcWeek( d, totWeek, throwAway, bStartOnMonday ); while ( totWeek == 1 ) { d = d.addDays( -1 ); calcWeek( d, totWeek, throwAway, bStartOnMonday ); } if ( totWeek != totalWeeks() ) setTotalWeeks( totWeek ); } void DateBookWeek::setTotalWeeks( int numWeeks ) { header->spinWeek->setMaxValue( numWeeks ); } int DateBookWeek::totalWeeks() const { return header->spinWeek->maxValue(); } void DateBookWeek::slotWeekChanged( bool onMonday ) { bStartOnMonday = onMonday; view->setStartOfWeek( bStartOnMonday ); header->setStartOfWeek( bStartOnMonday ); redraw(); } void DateBookWeek::slotClockChanged( bool ap ) { ampm = ap; } // return the date at the beginning of the week... QDate DateBookWeek::weekDate() const { return dateFromWeek( _week, year, bStartOnMonday ); } // this used to only be needed by datebook.cpp, but now we need it inside // week view since // we need to be able to figure out our total number of weeks on the fly... // this is probably the best place to put it.. // For Weeks that start on Monday... (EASY!) // At the moment we will use ISO 8601 method for computing // the week. Granted, other countries use other methods, // bet we aren't doing any Locale stuff at the moment. So, // this should pass. This Algorithim is public domain and // available at: // http://personal.ecu.edu/mccartyr/ISOwdALG.txt // the week number is return, and the year number is returned in year // for Instance 2001/12/31 is actually the first week in 2002. |