summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp42
-rw-r--r--korganizer/kowhatsnextview.h5
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)
QVBoxLayout lay ( &dia );
- KPIM::AddresseeView av ( &dia );
+ KABC::AddresseeView av ( &dia );
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 @@
#include <qapplication.h>
-
+#ifdef DESKTOP_VERSION
+#include <qpaintdevicemetrics.h>
+#endif
#include <kglobal.h>
@@ -58,2 +60,27 @@ void WhatsNextTextBrowser::setSource(const QString& n)
}
+void WhatsNextTextBrowser::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
+}
@@ -116,14 +143,3 @@ void KOWhatsNextView::printMe()
#ifdef DESKTOP_VERSION
- QPrinter printer;
- if (!printer.setup() )
- return;
- QTextBrowser tb;
- tb.setFixedSize( 600, 4000 );
- QPainter::redirect ( tb.viewport(), &printer );
- updateView();
- tb.setText( mText );
- tb.show();
- tb.repaint();
- tb.hide();
- KMessageBox::information( this, i18n("Printing What's Next View!\n\nPlease close after\nprinting is finished."));
+ mView->printMe();
#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 {
public:
- WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}
+ WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {};
void setSource(const QString &);
+ void printMe();
@@ -90,3 +91,3 @@ class KOWhatsNextView : public KOrg::BaseView
QTimer* mTimer;
- QTextBrowser *mView;
+ WhatsNextTextBrowser *mView;
QString mText;