summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index e8b7c94..8c2996b 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1975,65 +1975,65 @@ void KOAgenda::moveChild( QWidget *w, int x , int y )
#include <qpainter.h>
#include <qpaintdevicemetrics.h>
#endif
void KOAgenda::printSelection()
{
#ifdef DESKTOP_VERSION
if ( mStartCellY == mCurrentCellY ) {
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "),
i18n("OK"), 0, 0,
0, 1 );
return;
}
float dx, dy;
int x,y,w,h;
x= 0;
w= contentsWidth()+2;
// h= contentsHeight();
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;
// set the scale
p.drawText( offset* scale, offset* scale*3/4, date );
int selDay;
float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count()));
float startX = 1;
for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
{
QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true );
p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) );
p.drawText( offset* scale+startX, (offset+hei)* scale, text );
startX += widOffset;
}
p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale));
p.scale( scale, scale );
p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale );
// now printing with y offset: 2 hei
// p.translate( 0, -y*scale);