author | zautrix <zautrix> | 2005-01-16 22:19:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-16 22:19:12 (UTC) |
commit | 507b362d42d5eed6277ad17422b6ba61acca636e (patch) (side-by-side diff) | |
tree | d3d29451d37649b102c3e171e2927437925f8ce8 /kabc | |
parent | a704468d5fd02d30cf962c8b2d6815c7e9208e5d (diff) | |
download | kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.zip kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.gz kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.bz2 |
print AB
-rw-r--r-- | kabc/addresseeview.cpp | 38 | ||||
-rw-r--r-- | kabc/addresseeview.h | 4 |
2 files changed, 36 insertions, 6 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 7a4336b..e85991e 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp @@ -36,10 +36,15 @@ #include <qlayout.h> #include <qapplication.h> #include <qpushbutton.h> +#ifdef DESKTOP_VERSION +#include <qpaintdevicemetrics.h> +#include <qprinter.h> +#include <qpainter.h> +#endif #include "externalapphandler.h" -#include "addresseeview.h" +#include <kabc/addresseeview.h> //US #ifndef DESKTOP_VERSION @@ -49,10 +54,9 @@ //US static int kphoneInstalled = 0; -using namespace KPIM; +using namespace KABC; AddresseeView::AddresseeView( QWidget *parent, const char *name ) -//US : KTextBrowser( parent, name ) : QTextBrowser( parent, name ) @@ -67,7 +71,31 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) //US link->setColor( KGlobalSettings::linkColor() ); } - +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) { //qDebug("********AddresseeView::setSource %s", n.latin1()); @@ -211,7 +239,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) } if ( true /*!mAddressee.organization().isEmpty()*/ ) { aOrga = "<tr>" - "<td align=\"left\">" + mAddressee.organization() + "</td>" ; + "<td align=\"left\">" + mAddressee.organization() + "</td>" "</tr>"; } mText = ""; diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h index 3800512..e977d8f 100644 --- a/kabc/addresseeview.h +++ b/kabc/addresseeview.h @@ -28,11 +28,12 @@ //US #include <ktextbrowser.h> #include <qtextbrowser.h> -namespace KPIM { +namespace KABC { //US class AddresseeView : public KTextBrowser class AddresseeView : public QTextBrowser { + public: AddresseeView( QWidget *parent = 0, const char *name = 0 ); @@ -47,6 +48,7 @@ class AddresseeView : public QTextBrowser Returns the current addressee object. */ //KABC::Addressee addressee() const; + void printMe(); private: //KABC::Addressee mAddressee; |