summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-18 10:44:44 (UTC)
committer zautrix <zautrix>2005-03-18 10:44:44 (UTC)
commit414cb038cbe353f2fdb90969bc2531b687acc85f (patch) (side-by-side diff)
tree178c9da0d3a711a90beef435d32dcce50c53bdae /korganizer
parente972244f2a0581496301c7aa12e0498b34b48479 (diff)
downloadkdepimpi-414cb038cbe353f2fdb90969bc2531b687acc85f.zip
kdepimpi-414cb038cbe353f2fdb90969bc2531b687acc85f.tar.gz
kdepimpi-414cb038cbe353f2fdb90969bc2531b687acc85f.tar.bz2
print fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calprintbase.cpp20
-rw-r--r--korganizer/koagenda.cpp2
2 files changed, 8 insertions, 14 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp
index f66fddc..7b7d54c 100644
--- a/korganizer/calprintbase.cpp
+++ b/korganizer/calprintbase.cpp
@@ -643,58 +643,52 @@ void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p,
void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd,
int x, int y, int width, int height,
bool fullDate)
{
QString dayNumStr;
QString ampm;
const KLocale*local = KGlobal::locale();
// 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() );
}
p.eraseRect( x, y, width, height );
p.drawRect( x, y, width, height );
// p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) );
p.drawRect( x, y, width, mSubHeaderHeight );
//p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) );
QString hstring;
#ifndef KORG_NOPLUGINS
hstring=KOCore::self()->holiday(qd);
#endif
if (!hstring.isEmpty()) {
p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) );
p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter,
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;
eventList.fill( mCalendar->events( qd, true ));
Todo::List todos;
todos.fill( mCalendar->todos( qd ));
QString outStr;
p.setFont( QFont( "helvetica", 8 ) );
int lineSpacing = p.fontMetrics().lineSpacing();
int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry
Event::List::ConstIterator it;
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index e8b7c94..8c2996b 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1995,25 +1995,25 @@ void KOAgenda::printSelection()
y = mGridSpacingY*mStartCellY;
h = mGridSpacingY*(mCurrentCellY+1)-y+2;
//return;
QPrinter* printer = new QPrinter();
if ( !printer->setup()) {
delete printer;
return;
}
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;
// compute the scale
dx = ((float) m.width()-offset) / (float)w;
dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h;
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;