summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/kaddressbookcardview.cpp
Unidiff
Diffstat (limited to 'kaddressbook/views/kaddressbookcardview.cpp') (more/less context) (ignore 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
@@ -38,6 +38,7 @@
38#include "kabprefs.h" 38#include "kabprefs.h"
39#include "viewmanager.h" 39#include "viewmanager.h"
40 40
41
41#include "kaddressbookcardview.h" 42#include "kaddressbookcardview.h"
42 43
43#ifndef KAB_EMBEDDED 44#ifndef KAB_EMBEDDED
@@ -116,6 +117,32 @@ AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name)
116AddresseeCardView::~AddresseeCardView() 117AddresseeCardView::~AddresseeCardView()
117{ 118{
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
120 147
121void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) 148void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e)
@@ -164,6 +191,8 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
164 this, SIGNAL(dropped(QDropEvent*))); 191 this, SIGNAL(dropped(QDropEvent*)));
165 connect(mCardView, SIGNAL(startAddresseeDrag()), 192 connect(mCardView, SIGNAL(startAddresseeDrag()),
166 this, SIGNAL(startDrag())); 193 this, SIGNAL(startDrag()));
194 connect(this, SIGNAL(printView()),
195 mCardView , SLOT(printMe()));
167} 196}
168 197
169KAddressBookCardView::~KAddressBookCardView() 198KAddressBookCardView::~KAddressBookCardView()