summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/kaddressbookcardview.cpp
Unidiff
Diffstat (limited to 'kaddressbook/views/kaddressbookcardview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index 2d7ed08..107be59 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -40,2 +40,3 @@
40 40
41
41#include "kaddressbookcardview.h" 42#include "kaddressbookcardview.h"
@@ -118,2 +119,28 @@ AddresseeCardView::~AddresseeCardView()
118} 119}
120void AddresseeCardView::printMe()
121{
122#ifdef DESKTOP_VERSION
123 QPrinter printer;
124 if (!printer.setup() )
125 return;
126 QPainter p;
127 p.begin ( &printer );
128 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
129 float dx, dy;
130 int wid = (m.width() * 9)/10;
131 dx = (float) wid/(float)contentsWidth ();
132 dy = (float)(m.height()) / (float)contentsHeight ();
133 float scale;
134 // scale to fit the width or height of the paper
135 if ( dx < dy )
136 scale = dx;
137 else
138 scale = dy;
139 p.translate( m.width()/10,0 );
140 p.scale( scale, scale );
141 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
142 p.end();
143 repaint();
144#endif
145}
119 146
@@ -166,2 +193,4 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
166 this, SIGNAL(startDrag())); 193 this, SIGNAL(startDrag()));
194 connect(this, SIGNAL(printView()),
195 mCardView , SLOT(printMe()));
167} 196}