From 414cb038cbe353f2fdb90969bc2531b687acc85f Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 18 Mar 2005 10:44:44 +0000 Subject: print fix --- (limited to 'korganizer') diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp index f66fddc..7b7d54c 100644 --- a/korganizer/calprintbase.cpp +++ b/korganizer/calprintbase.cpp @@ -652,19 +652,7 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, // This has to be localized if (fullDate) { - /*int index; - dayNumStr= qd.toString(); - index = dayNumStr.find(' '); - dayNumStr.remove(0, index); - index = dayNumStr.findRev(' '); - dayNumStr.truncate(index);*/ - - const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); - dayNumStr = i18n("weekday month date", "%1 %2 %3") - .arg( calSys->weekDayName( qd ) ) - .arg( calSys->monthName( qd ) ) - .arg( qd.day() ); -// dayNumStr = local->formatDate(qd); + dayNumStr = local->formatDate(qd); } else { dayNumStr = QString::number( qd.day() ); } @@ -686,6 +674,12 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, hstring ); } p.setFont(QFont("helvetica", 10, QFont::Bold)); + if ( fullDate) { + // use short date format, if long date is too long + QFontMetrics fm ( p.font() ); + if ( fm.width( dayNumStr ) > width -10 ) + dayNumStr = local->formatDate(qd, true); + } p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, dayNumStr); Event::List eventList; diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index e8b7c94..8c2996b 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -2004,7 +2004,7 @@ void KOAgenda::printSelection() QPainter p( printer ); QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); - date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); + //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); // p.drawText( 0, 0, date ); int offset = m.width()/8; -- cgit v0.9.0.2