-rw-r--r-- | kabc/addresseeview.cpp | 38 |
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 | |||
@@ -33,29 +33,33 @@ | |||
33 | #include <qvbox.h> | 33 | #include <qvbox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qwidget.h> | 35 | #include <qwidget.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
39 | #ifdef DESKTOP_VERSION | ||
40 | #include <qpaintdevicemetrics.h> | ||
41 | #include <qprinter.h> | ||
42 | #include <qpainter.h> | ||
43 | #endif | ||
39 | 44 | ||
40 | 45 | ||
41 | #include "externalapphandler.h" | 46 | #include "externalapphandler.h" |
42 | #include "addresseeview.h" | 47 | #include <kabc/addresseeview.h> |
43 | 48 | ||
44 | 49 | ||
45 | //US #ifndef DESKTOP_VERSION | 50 | //US #ifndef DESKTOP_VERSION |
46 | //US #include <qtopia/qcopenvelope_qws.h> | 51 | //US #include <qtopia/qcopenvelope_qws.h> |
47 | //US #include <qpe/qpeapplication.h> | 52 | //US #include <qpe/qpeapplication.h> |
48 | //US #endif | 53 | //US #endif |
49 | 54 | ||
50 | //US static int kphoneInstalled = 0; | 55 | //US static int kphoneInstalled = 0; |
51 | 56 | ||
52 | using namespace KPIM; | 57 | using namespace KABC; |
53 | 58 | ||
54 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 59 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
55 | //US : KTextBrowser( parent, name ) | ||
56 | : QTextBrowser( parent, name ) | 60 | : QTextBrowser( parent, name ) |
57 | 61 | ||
58 | 62 | ||
59 | { | 63 | { |
60 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 64 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
61 | setLinkUnderline( false ); | 65 | setLinkUnderline( false ); |
@@ -64,13 +68,37 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) | |||
64 | 68 | ||
65 | //US QStyleSheet *sheet = styleSheet(); | 69 | //US QStyleSheet *sheet = styleSheet(); |
66 | //US QStyleSheetItem *link = sheet->item( "a" ); | 70 | //US QStyleSheetItem *link = sheet->item( "a" ); |
67 | //US link->setColor( KGlobalSettings::linkColor() ); | 71 | //US link->setColor( KGlobalSettings::linkColor() ); |
68 | 72 | ||
69 | } | 73 | } |
70 | 74 | void AddresseeView::printMe() | |
75 | { | ||
76 | #ifdef DESKTOP_VERSION | ||
77 | QPrinter printer; | ||
78 | if (!printer.setup() ) | ||
79 | return; | ||
80 | QPainter p; | ||
81 | p.begin ( &printer ); | ||
82 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | ||
83 | float dx, dy; | ||
84 | int wid = (m.width() * 9)/10; | ||
85 | dx = (float) wid/(float)contentsWidth (); | ||
86 | dy = (float)(m.height()) / (float)contentsHeight (); | ||
87 | float scale; | ||
88 | // scale to fit the width or height of the paper | ||
89 | if ( dx < dy ) | ||
90 | scale = dx; | ||
91 | else | ||
92 | scale = dy; | ||
93 | p.translate( m.width()/10,0 ); | ||
94 | p.scale( scale, scale ); | ||
95 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | ||
96 | p.end(); | ||
97 | #endif | ||
98 | } | ||
71 | void AddresseeView::setSource(const QString& n) | 99 | void AddresseeView::setSource(const QString& n) |
72 | { | 100 | { |
73 | //qDebug("********AddresseeView::setSource %s", n.latin1()); | 101 | //qDebug("********AddresseeView::setSource %s", n.latin1()); |
74 | 102 | ||
75 | if ( n.left( 6 ) == "mailto" ) | 103 | if ( n.left( 6 ) == "mailto" ) |
76 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); | 104 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); |
@@ -208,13 +236,13 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | |||
208 | aRole = "<tr>" | 236 | aRole = "<tr>" |
209 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 237 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
210 | "</tr>"; | 238 | "</tr>"; |
211 | } | 239 | } |
212 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 240 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
213 | aOrga = "<tr>" | 241 | aOrga = "<tr>" |
214 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; | 242 | "<td align=\"left\">" + mAddressee.organization() + "</td>" |
215 | "</tr>"; | 243 | "</tr>"; |
216 | } | 244 | } |
217 | mText = ""; | 245 | mText = ""; |
218 | QString picString = ""; | 246 | QString picString = ""; |
219 | KABC::Picture picture = mAddressee.photo(); | 247 | KABC::Picture picture = mAddressee.photo(); |
220 | bool picAvailintern = false; | 248 | bool picAvailintern = false; |