summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
Side-by-side diff
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
@@ -35,12 +35,17 @@
#include <qwidget.h>
#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
//US #include <qtopia/qcopenvelope_qws.h>
@@ -48,12 +53,11 @@
//US #endif
//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 )
{
@@ -66,9 +70,33 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name )
//US QStyleSheetItem *link = sheet->item( "a" );
//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());
@@ -210,9 +238,9 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
"</tr>";
}
if ( true /*!mAddressee.organization().isEmpty()*/ ) {
aOrga = "<tr>"
- "<td align=\"left\">" + mAddressee.organization() + "</td>" ;
+ "<td align=\"left\">" + mAddressee.organization() + "</td>"
"</tr>";
}
mText = "";
QString picString = "";