summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
authorzautrix <zautrix>2005-01-16 22:19:12 (UTC)
committer zautrix <zautrix>2005-01-16 22:19:12 (UTC)
commit507b362d42d5eed6277ad17422b6ba61acca636e (patch) (side-by-side diff)
treed3d29451d37649b102c3e171e2927437925f8ce8 /kabc/addresseeview.cpp
parenta704468d5fd02d30cf962c8b2d6815c7e9208e5d (diff)
downloadkdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.zip
kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.gz
kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.bz2
print AB
Diffstat (limited to 'kabc/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp38
1 files changed, 33 insertions, 5 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 7a4336b..e85991e 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -38,2 +38,7 @@
#include <qpushbutton.h>
+#ifdef DESKTOP_VERSION
+#include <qpaintdevicemetrics.h>
+#include <qprinter.h>
+#include <qpainter.h>
+#endif
@@ -41,3 +46,3 @@
#include "externalapphandler.h"
-#include "addresseeview.h"
+#include <kabc/addresseeview.h>
@@ -51,6 +56,5 @@
-using namespace KPIM;
+using namespace KABC;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
-//US : KTextBrowser( parent, name )
: QTextBrowser( parent, name )
@@ -69,3 +73,27 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name )
}
-
+void AddresseeView::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 );
+ drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
+ p.end();
+#endif
+}
void AddresseeView::setSource(const QString& n)
@@ -213,3 +241,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
aOrga = "<tr>"
- "<td align=\"left\">" + mAddressee.organization() + "</td>" ;
+ "<td align=\"left\">" + mAddressee.organization() + "</td>"
"</tr>";