summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/contactlistview.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/views/contactlistview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/views/contactlistview.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index 23b091c..e75810e 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -268,24 +268,51 @@ ContactListView::ContactListView(KAddressBookTableView *view,
// setFrameStyle(QFrame::NoFrame);
//setLineWidth ( 0 );
//setMidLineWidth ( 0 );
//setMargin ( 0 );
#ifndef KAB_EMBEDDED
connect(this, SIGNAL(dropped(QDropEvent*)),
this, SLOT(itemDropped(QDropEvent*)));
#endif //KAB_EMBEDDED
new DynamicTip( this );
}
+void ContactListView::printMe()
+{
+#ifdef DESKTOP_VERSION
+ QPrinter printer;
+ if (!printer.setup() )
+ return;
+ QPainter p;
+ p.begin ( &printer );
+ QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ float dx, dy;
+ int wid = (m.width() * 9)/10;
+ dx = (float) wid/(float)contentsWidth ();
+ dy = (float)(m.height()) / (float)contentsHeight ();
+ float scale;
+ // scale to fit the width or height of the paper
+ if ( dx < dy )
+ scale = dx;
+ else
+ scale = dy;
+ p.translate( m.width()/10,0 );
+ p.scale( scale, scale );
+ qDebug("scale %f ", scale);
+ drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
+ p.end();
+ qDebug("Why does it not print??? ");
+#endif
+}
void ContactListView::setAlternateColor(const QColor &m_AlternateColor)
{
mAlternateColor = m_AlternateColor;
}
void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect )
{
QBrush b = palette().brush(QPalette::Active, QColorGroup::Base);
// Get the brush, which will have the background pixmap if there is one.
if (b.pixmap())