-rw-r--r-- | korganizer/calprintbase.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp index f66fddc..7b7d54c 100644 --- a/korganizer/calprintbase.cpp +++ b/korganizer/calprintbase.cpp | |||
@@ -649,25 +649,13 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
649 | QString ampm; | 649 | QString ampm; |
650 | const KLocale*local = KGlobal::locale(); | 650 | const KLocale*local = KGlobal::locale(); |
651 | 651 | ||
652 | 652 | ||
653 | // This has to be localized | 653 | // This has to be localized |
654 | if (fullDate) { | 654 | if (fullDate) { |
655 | /*int index; | 655 | dayNumStr = local->formatDate(qd); |
656 | dayNumStr= qd.toString(); | ||
657 | index = dayNumStr.find(' '); | ||
658 | dayNumStr.remove(0, index); | ||
659 | index = dayNumStr.findRev(' '); | ||
660 | dayNumStr.truncate(index);*/ | ||
661 | |||
662 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | ||
663 | dayNumStr = i18n("weekday month date", "%1 %2 %3") | ||
664 | .arg( calSys->weekDayName( qd ) ) | ||
665 | .arg( calSys->monthName( qd ) ) | ||
666 | .arg( qd.day() ); | ||
667 | // dayNumStr = local->formatDate(qd); | ||
668 | } else { | 656 | } else { |
669 | dayNumStr = QString::number( qd.day() ); | 657 | dayNumStr = QString::number( qd.day() ); |
670 | } | 658 | } |
671 | 659 | ||
672 | p.eraseRect( x, y, width, height ); | 660 | p.eraseRect( x, y, width, height ); |
673 | p.drawRect( x, y, width, height ); | 661 | p.drawRect( x, y, width, height ); |
@@ -683,12 +671,18 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
683 | p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); | 671 | p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); |
684 | 672 | ||
685 | p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, | 673 | p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, |
686 | hstring ); | 674 | hstring ); |
687 | } | 675 | } |
688 | p.setFont(QFont("helvetica", 10, QFont::Bold)); | 676 | p.setFont(QFont("helvetica", 10, QFont::Bold)); |
677 | if ( fullDate) { | ||
678 | // use short date format, if long date is too long | ||
679 | QFontMetrics fm ( p.font() ); | ||
680 | if ( fm.width( dayNumStr ) > width -10 ) | ||
681 | dayNumStr = local->formatDate(qd, true); | ||
682 | } | ||
689 | p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, | 683 | p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, |
690 | dayNumStr); | 684 | dayNumStr); |
691 | Event::List eventList; | 685 | Event::List eventList; |
692 | eventList.fill( mCalendar->events( qd, true )); | 686 | eventList.fill( mCalendar->events( qd, true )); |
693 | Todo::List todos; | 687 | Todo::List todos; |
694 | todos.fill( mCalendar->todos( qd )); | 688 | todos.fill( mCalendar->todos( qd )); |