summaryrefslogtreecommitdiffabout
path: root/korganizer/koeventviewer.cpp
authorzautrix <zautrix>2005-03-28 19:26:15 (UTC)
committer zautrix <zautrix>2005-03-28 19:26:15 (UTC)
commitea070abfcff313cac87dbb4d5c9410784740de21 (patch) (unidiff)
tree3e95608a0444030016eb6845b95a582e265c1dad /korganizer/koeventviewer.cpp
parent57f95bb15f732ede3ddc68b077b6a5476246e971 (diff)
downloadkdepimpi-ea070abfcff313cac87dbb4d5c9410784740de21.zip
kdepimpi-ea070abfcff313cac87dbb4d5c9410784740de21.tar.gz
kdepimpi-ea070abfcff313cac87dbb4d5c9410784740de21.tar.bz2
print fixes
Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 445fc86..dbe0668 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -66,42 +66,53 @@ KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
66{ 66{
67 mSyncMode = false; 67 mSyncMode = false;
68 mColorMode = 0; 68 mColorMode = 0;
69} 69}
70 70
71KOEventViewer::~KOEventViewer() 71KOEventViewer::~KOEventViewer()
72{ 72{
73} 73}
74 74
75void KOEventViewer::printMe() 75void KOEventViewer::printMe()
76{ 76{
77#ifdef DESKTOP_VERSION 77#ifdef DESKTOP_VERSION
78
79 KOPrintPrefs pp ( this );
80 if (!pp.exec() )
81 return;
82 int scaleval = pp.printMode() ;
83
78 QPrinter printer; 84 QPrinter printer;
79 if (!printer.setup() ) 85 if (!printer.setup() )
80 return; 86 return;
81 QPainter p; 87 QPainter p;
82 p.begin ( &printer ); 88 p.begin ( &printer );
83 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
84 float dx, dy; 90 float dx, dy;
85 int wid = (m.width() * 9)/10; 91 int wid = (m.width() * 9)/10;
86 dx = (float) wid/(float)contentsWidth (); 92 dx = (float) wid/(float)contentsWidth ();
87 dy = (float)(m.height()) / (float)contentsHeight (); 93 dy = (float)(m.height()) / (float)contentsHeight ();
88 float scale; 94 float scale;
89 // scale to fit the width or height of the paper 95 // scale to fit the width or height of the paper
90 if ( dx < dy ) 96 if ( dx < dy )
91 scale = dx; 97 scale = dx;
92 else 98 else
93 scale = dy; 99 scale = dy;
100
94 p.translate( m.width()/10,0 ); 101 p.translate( m.width()/10,0 );
95 p.scale( scale, scale ); 102 qDebug("Scale: %f ", scale );
103 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
104 qDebug("SCALE ");
105 p.scale( scale, scale );
106 }
96 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 107 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
97 p.end(); 108 p.end();
98#endif 109#endif
99 110
100} 111}
101void KOEventViewer::setSource(const QString& n) 112void KOEventViewer::setSource(const QString& n)
102{ 113{
103 114
104 if ( n.left(3) == "uid" ) 115 if ( n.left(3) == "uid" )
105#ifdef DESKTOP_VERSION 116#ifdef DESKTOP_VERSION
106 { 117 {
107 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 118 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );