-rw-r--r-- | korganizer/koeventviewer.cpp | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 42 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 5 |
3 files changed, 33 insertions, 16 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index cee0466..5de667e 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -89,3 +89,3 @@ void KOEventViewer::setSource(const QString& n) | |||
89 | QVBoxLayout lay ( &dia ); | 89 | QVBoxLayout lay ( &dia ); |
90 | KPIM::AddresseeView av ( &dia ); | 90 | KABC::AddresseeView av ( &dia ); |
91 | av.setAddressee( (*it) ); | 91 | av.setAddressee( (*it) ); |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 219f7c3..7166a01 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -26,3 +26,5 @@ | |||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | 27 | #ifdef DESKTOP_VERSION | |
28 | #include <qpaintdevicemetrics.h> | ||
29 | #endif | ||
28 | #include <kglobal.h> | 30 | #include <kglobal.h> |
@@ -58,2 +60,27 @@ void WhatsNextTextBrowser::setSource(const QString& n) | |||
58 | } | 60 | } |
61 | void WhatsNextTextBrowser::printMe() | ||
62 | { | ||
63 | #ifdef DESKTOP_VERSION | ||
64 | QPrinter printer; | ||
65 | if (!printer.setup() ) | ||
66 | return; | ||
67 | QPainter p; | ||
68 | p.begin ( &printer ); | ||
69 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | ||
70 | float dx, dy; | ||
71 | int wid = (m.width() * 9)/10; | ||
72 | dx = (float) wid/(float)contentsWidth (); | ||
73 | dy = (float)(m.height()) / (float)contentsHeight (); | ||
74 | float scale; | ||
75 | // scale to fit the width or height of the paper | ||
76 | if ( dx < dy ) | ||
77 | scale = dx; | ||
78 | else | ||
79 | scale = dy; | ||
80 | p.translate( m.width()/10,0 ); | ||
81 | p.scale( scale, scale ); | ||
82 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | ||
83 | p.end(); | ||
84 | #endif | ||
85 | } | ||
59 | 86 | ||
@@ -116,14 +143,3 @@ void KOWhatsNextView::printMe() | |||
116 | #ifdef DESKTOP_VERSION | 143 | #ifdef DESKTOP_VERSION |
117 | QPrinter printer; | 144 | mView->printMe(); |
118 | if (!printer.setup() ) | ||
119 | return; | ||
120 | QTextBrowser tb; | ||
121 | tb.setFixedSize( 600, 4000 ); | ||
122 | QPainter::redirect ( tb.viewport(), &printer ); | ||
123 | updateView(); | ||
124 | tb.setText( mText ); | ||
125 | tb.show(); | ||
126 | tb.repaint(); | ||
127 | tb.hide(); | ||
128 | KMessageBox::information( this, i18n("Printing What's Next View!\n\nPlease close after\nprinting is finished.")); | ||
129 | #endif | 145 | #endif |
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index 0231cf2..715037f 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h | |||
@@ -36,5 +36,6 @@ class WhatsNextTextBrowser : public QTextBrowser { | |||
36 | public: | 36 | public: |
37 | WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} | 37 | WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}; |
38 | 38 | ||
39 | void setSource(const QString &); | 39 | void setSource(const QString &); |
40 | void printMe(); | ||
40 | 41 | ||
@@ -90,3 +91,3 @@ class KOWhatsNextView : public KOrg::BaseView | |||
90 | QTimer* mTimer; | 91 | QTimer* mTimer; |
91 | QTextBrowser *mView; | 92 | WhatsNextTextBrowser *mView; |
92 | QString mText; | 93 | QString mText; |