Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventviewer.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 1508638..445fc86 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -52,8 +52,11 @@ #ifdef DESKTOP_VERSION #include <kabc/addresseedialog.h> #include <kabc/addresseeview.h> +#include <qprinter.h> +#include <qpainter.h> +#include <qpaintdevicemetrics.h> #else //DESKTOP_VERSION #include <externalapphandler.h> #include <qtopia/qcopenvelope_qws.h> #endif //DESKTOP_VERSION @@ -68,8 +71,34 @@ KOEventViewer::KOEventViewer(QWidget *parent,const char *name) KOEventViewer::~KOEventViewer() { } +void KOEventViewer::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 KOEventViewer::setSource(const QString& n) { if ( n.left(3) == "uid" ) |