summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
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/koagenda.cpp
parente972244f2a0581496301c7aa12e0498b34b48479 (diff)
downloadkdepimpi-414cb038cbe353f2fdb90969bc2531b687acc85f.zip
kdepimpi-414cb038cbe353f2fdb90969bc2531b687acc85f.tar.gz
kdepimpi-414cb038cbe353f2fdb90969bc2531b687acc85f.tar.bz2
print fix
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
@@ -1911,146 +1911,146 @@ DateList KOAgenda::dateList() const
return mSelectedDates;
}
void KOAgenda::setDateList(const DateList &selectedDates)
{
mSelectedDates = selectedDates;
marcus_bains();
}
void KOAgenda::setHolidayMask(QMemArray<bool> *mask)
{
mHolidayMask = mask;
/*
kdDebug() << "HolidayMask: ";
for(uint i=0;i<mask->count();++i) {
kdDebug() << (mask->at(i) ? "*" : "o");
}
kdDebug() << endl;
*/
}
void KOAgenda::contentsMousePressEvent ( QMouseEvent *event )
{
QScrollView::contentsMousePressEvent(event);
}
void KOAgenda::storePosition()
{
//mContentPosition
int max = mGridSpacingY*4*24;
if ( contentsY() < 5 && max > viewport()->height()*3/2 )
mContentPosition = 0;
else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2)
mContentPosition = -1.0;
else
mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2)));
//qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height());
}
void KOAgenda::restorePosition()
{
int posY;
int max = mGridSpacingY*4*24;
if ( mContentPosition < 0 )
posY = max-viewport()->height();
else
if ( mContentPosition == 0 )
posY = 0;
else
posY = (max/mContentPosition)-(viewport()->height()/2);
setContentsPos (0, posY );
//qDebug("posY %d hei %d", posY, max);
}
void KOAgenda::moveChild( QWidget *w, int x , int y )
{
++x;
QScrollView::moveChild( w, x , y );
}
#include <qmessagebox.h>
#ifdef DESKTOP_VERSION
#include <qprinter.h>
#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);
drawContentsToPainter(&p, true );
globalFlagBlockAgendaItemUpdate = false;
KOAgendaItem *item;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
item->select(false);
item->paintMe( false, &p );
}
globalFlagBlockAgendaItemUpdate = true;
p.end();
delete printer;
#else
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("Not supported \non PDA!\n"),
i18n("OK"), 0, 0,
0, 1 );
#endif
}