summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2007-06-05 13:21:33 (UTC)
committer zautrix <zautrix>2007-06-05 13:21:33 (UTC)
commitd5c53970b9e12bfe774d1fecd603080aded24e09 (patch) (unidiff)
treefca3c555b3e37302ebe1ee1840fa3e27502dcc50 /korganizer
parenta388f4f019ccf2b7c138a6814b44b9e8f2a5f570 (diff)
downloadkdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.zip
kdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.tar.gz
kdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.tar.bz2
print fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b378330..192f8c0 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1313,126 +1313,146 @@ bool KOListViewListView::hasMultiSelection(QListViewItem* item)
1313 } 1313 }
1314 return false; 1314 return false;
1315} 1315}
1316void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1316void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1317{ 1317{
1318 if (!e) return; 1318 if (!e) return;
1319 QPoint vp = contentsToViewport(e->pos()); 1319 QPoint vp = contentsToViewport(e->pos());
1320 QListViewItem *item = itemAt(vp); 1320 QListViewItem *item = itemAt(vp);
1321 if (!item) { 1321 if (!item) {
1322 emit newEvent(); 1322 emit newEvent();
1323 return; 1323 return;
1324 } 1324 }
1325 KListView::contentsMouseDoubleClickEvent(e); 1325 KListView::contentsMouseDoubleClickEvent(e);
1326} 1326}
1327#if 0 1327#if 0
1328void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1328void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1329{ 1329{
1330 //qDebug("contentsMousePressEvent++++ "); 1330 //qDebug("contentsMousePressEvent++++ ");
1331 KListView::contentsMousePressEvent( e ); 1331 KListView::contentsMousePressEvent( e );
1332 if ( e->button() == RightButton ) { 1332 if ( e->button() == RightButton ) {
1333 QListViewItem* ci = currentItem(); 1333 QListViewItem* ci = currentItem();
1334 clearSelection () ; 1334 clearSelection () ;
1335 if ( ci ) 1335 if ( ci )
1336 ci->setSelected( true ); 1336 ci->setSelected( true );
1337 } 1337 }
1338} 1338}
1339void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1339void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1340{ 1340{
1341 KListView::contentsMouseReleaseEvent(e); 1341 KListView::contentsMouseReleaseEvent(e);
1342} 1342}
1343void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1343void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1344{ 1344{
1345 KListView::contentsMouseMoveEvent(e); 1345 KListView::contentsMouseMoveEvent(e);
1346} 1346}
1347#endif 1347#endif
1348void KOListViewListView::popupMenu() 1348void KOListViewListView::popupMenu()
1349{ 1349{
1350 mPopupTimer->stop(); 1350 mPopupTimer->stop();
1351 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); 1351 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton );
1352 QApplication::postEvent( this->viewport(), e ); 1352 QApplication::postEvent( this->viewport(), e );
1353 1353
1354} 1354}
1355void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1355void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1356{ 1356{
1357 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); 1357 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
1358 mYMousePos = mapToGlobal( (e->pos())).y(); 1358 mYMousePos = mapToGlobal( (e->pos())).y();
1359 if ( e->button() == LeftButton ) { 1359 if ( e->button() == LeftButton ) {
1360 mPopupTimer->start( 600 ); 1360 mPopupTimer->start( 600 );
1361 mEventPos = contentsToViewport(e->pos()); 1361 mEventPos = contentsToViewport(e->pos());
1362 mEventGlobalPos = e->globalPos(); 1362 mEventGlobalPos = e->globalPos();
1363 } 1363 }
1364 KListView::contentsMousePressEvent( e ); 1364 KListView::contentsMousePressEvent( e );
1365 if ( e->button() == RightButton ) { 1365 if ( e->button() == RightButton ) {
1366 QListViewItem* ci = currentItem(); 1366 QListViewItem* ci = currentItem();
1367 //clearSelection(); 1367 //clearSelection();
1368 if ( ci ) 1368 if ( ci )
1369 ci->setSelected( true ); 1369 ci->setSelected( true );
1370 } 1370 }
1371} 1371}
1372void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1372void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1373{ 1373{
1374 mPopupTimer->stop(); 1374 mPopupTimer->stop();
1375 KListView::contentsMouseReleaseEvent(e); 1375 KListView::contentsMouseReleaseEvent(e);
1376} 1376}
1377void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1377void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1378{ 1378{
1379 // qDebug("contentsMouseMoveEv....... "); 1379 // qDebug("contentsMouseMoveEv....... ");
1380 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1380 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1381 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1381 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1382 if ( diff < 0 ) diff = -diff; 1382 if ( diff < 0 ) diff = -diff;
1383 if ( diff > 15 ) 1383 if ( diff > 15 )
1384 mPopupTimer->stop(); 1384 mPopupTimer->stop();
1385 else { 1385 else {
1386 mEventPos = contentsToViewport(e->pos()); 1386 mEventPos = contentsToViewport(e->pos());
1387 mEventGlobalPos = e->globalPos(); 1387 mEventGlobalPos = e->globalPos();
1388 } 1388 }
1389 KListView::contentsMouseMoveEvent(e); 1389 KListView::contentsMouseMoveEvent(e);
1390} 1390}
1391 1391
1392#define protected public 1392#define protected public
1393#include <qheader.h> 1393#include <qheader.h>
1394#undef protected 1394#undef protected
1395void KOListViewListView::printList() 1395void KOListViewListView::printList()
1396{ 1396{
1397#ifdef DESKTOP_VERSION 1397#ifdef DESKTOP_VERSION
1398 KOPrintPrefs pp ( this ); 1398 KOPrintPrefs pp ( this );
1399 if (!pp.exec() ) 1399 if (!pp.exec() )
1400 return; 1400 return;
1401 int scaleval = pp.printMode() ; 1401 int scaleval = pp.printMode() ;
1402 1402
1403 QPrinter printer; 1403 QPrinter printer;
1404 if (!printer.setup() ) 1404 if (!printer.setup() )
1405 return; 1405 return;
1406 clearSelection (); 1406 clearSelection ();
1407 QPainter p; 1407 QPainter p;
1408 p.begin ( &printer ); 1408 p.begin ( &printer );
1409 p.setFont(font());
1409 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 1410 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
1410 float dx, dy; 1411 float dx, dy;
1411 int wid = (m.width() * 9)/10; 1412 int wid = (m.width() * 9)/10;
1412 dx = (float) wid/(float)contentsWidth (); 1413 dx = (float) wid/(float)contentsWidth ();
1413 dy = (float)(m.height()) / (float)contentsHeight (); 1414 dy = (float)(m.height()) / (float)contentsHeight ();
1414 float scale; 1415 float scale;
1415 // scale to fit the width or height of the paper 1416 // scale to fit the width or height of the paper
1416 if ( dx < dy ) 1417 if ( dx < dy )
1417 scale = dx; 1418 scale = dx;
1418 else 1419 else
1419 scale = dy; 1420 scale = dy;
1420 1421
1421 p.translate( m.width()/10,m.width()/10 ); 1422 p.translate( m.width()/10,m.width()/10 );
1422 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 1423 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
1423 p.scale( scale, scale ); 1424 p.scale( scale, scale );
1424 } 1425 }
1425 1426
1426 int cou = header()->count(); 1427 int cou = header()->count();
1427 int iii; 1428 int iii;
1428 QRect rect ( 0,0,0, header()->height()); 1429 QRect rect ( 0,0,0, header()->height());
1429 for ( iii = 0; iii < cou; ++iii ) { 1430 for ( iii = 0; iii < cou; ++iii ) {
1430 rect.setLeft ( header()->sectionPos( iii ) ); 1431 rect.setLeft ( header()->sectionPos( iii ) );
1431 rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); 1432 rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii));
1432 header()->paintSection ( & p, header()->mapToIndex (iii), rect ); 1433 header()->paintSection ( & p, header()->mapToIndex (iii), rect );
1433 } 1434 }
1434 p.translate( 0, header()->height()); 1435 p.translate( 0, header()->height());
1435 drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); 1436 //drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () );
1437
1438 const QColorGroup &cg = colorGroup();
1439 KOListViewItem* item = (KOListViewItem* )firstChild();
1440 int yOff = 0;
1441 while ( item ) {
1442 p.translate( 0, yOff );
1443 p.save();
1444 for ( iii = 0; iii < cou; ++iii ) {
1445 int align = columnAlignment( iii );
1446 if ( align == AlignAuto ) align = AlignLeft;
1447 p.restore();
1448 p.save();
1449 p.translate( header()->sectionPos( iii ), 0);
1450 item->paintCell( &p, cg, iii, header()->sectionSize (iii), align );
1451 }
1452 yOff = item->height();
1453 item = (KOListViewItem* )(item->itemBelow());
1454 p.restore();
1455 }
1436 p.end(); 1456 p.end();
1437#endif 1457#endif
1438} 1458}