author | zautrix <zautrix> | 2005-01-16 22:19:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-16 22:19:12 (UTC) |
commit | 507b362d42d5eed6277ad17422b6ba61acca636e (patch) (unidiff) | |
tree | d3d29451d37649b102c3e171e2927437925f8ce8 | |
parent | a704468d5fd02d30cf962c8b2d6815c7e9208e5d (diff) | |
download | kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.zip kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.gz kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.bz2 |
print AB
-rw-r--r-- | kabc/addresseeview.cpp | 38 | ||||
-rw-r--r-- | kabc/addresseeview.h | 4 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.h | 1 | ||||
-rw-r--r-- | kaddressbook/details/look_basic.h | 2 | ||||
-rw-r--r-- | kaddressbook/details/look_html.cpp | 10 | ||||
-rw-r--r-- | kaddressbook/details/look_html.h | 8 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 21 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 9 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 3 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 27 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 29 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 42 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 5 |
22 files changed, 176 insertions, 40 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 7a4336b..e85991e 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -38,2 +38,7 @@ | |||
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 | ||
@@ -41,3 +46,3 @@ | |||
41 | #include "externalapphandler.h" | 46 | #include "externalapphandler.h" |
42 | #include "addresseeview.h" | 47 | #include <kabc/addresseeview.h> |
43 | 48 | ||
@@ -51,6 +56,5 @@ | |||
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 ) |
@@ -69,3 +73,27 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) | |||
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) |
@@ -213,3 +241,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | |||
213 | aOrga = "<tr>" | 241 | aOrga = "<tr>" |
214 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; | 242 | "<td align=\"left\">" + mAddressee.organization() + "</td>" |
215 | "</tr>"; | 243 | "</tr>"; |
diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h index 3800512..e977d8f 100644 --- a/kabc/addresseeview.h +++ b/kabc/addresseeview.h | |||
@@ -30,3 +30,3 @@ | |||
30 | 30 | ||
31 | namespace KPIM { | 31 | namespace KABC { |
32 | 32 | ||
@@ -35,2 +35,3 @@ class AddresseeView : public QTextBrowser | |||
35 | { | 35 | { |
36 | |||
36 | public: | 37 | public: |
@@ -49,2 +50,3 @@ class AddresseeView : public QTextBrowser | |||
49 | //KABC::Addressee addressee() const; | 50 | //KABC::Addressee addressee() const; |
51 | void printMe(); | ||
50 | 52 | ||
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp index 229cce0..cee5886 100644 --- a/kaddressbook/details/detailsviewcontainer.cpp +++ b/kaddressbook/details/detailsviewcontainer.cpp | |||
@@ -80,2 +80,6 @@ ViewContainer::ViewContainer( QWidget *parent, const char* name ) | |||
80 | 80 | ||
81 | void ViewContainer::printView() | ||
82 | { | ||
83 | mCurrentLook->printView(); | ||
84 | } | ||
81 | KABBasicLook *ViewContainer::currentLook() | 85 | KABBasicLook *ViewContainer::currentLook() |
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h index 667f0cb..9684736 100644 --- a/kaddressbook/details/detailsviewcontainer.h +++ b/kaddressbook/details/detailsviewcontainer.h | |||
@@ -53,2 +53,3 @@ class ViewContainer : public QWidget | |||
53 | public slots: | 53 | public slots: |
54 | void printView(); | ||
54 | /** | 55 | /** |
diff --git a/kaddressbook/details/look_basic.h b/kaddressbook/details/look_basic.h index 7e8baff..a65c99c 100644 --- a/kaddressbook/details/look_basic.h +++ b/kaddressbook/details/look_basic.h | |||
@@ -77,4 +77,6 @@ class KABBasicLook : public QVBox | |||
77 | bool isReadOnly() const; | 77 | bool isReadOnly() const; |
78 | void printView(){ emit printMyView();} | ||
78 | 79 | ||
79 | signals: | 80 | signals: |
81 | void printMyView(); | ||
80 | /** | 82 | /** |
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp index 64987b8..bb30650 100644 --- a/kaddressbook/details/look_html.cpp +++ b/kaddressbook/details/look_html.cpp | |||
@@ -28,2 +28,3 @@ | |||
28 | #include "kabprefs.h" | 28 | #include "kabprefs.h" |
29 | #include <kabc/addresseeview.h> | ||
29 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) | 30 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) |
@@ -31,4 +32,6 @@ KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) | |||
31 | { | 32 | { |
32 | mView = new KPIM::AddresseeView( this ); | 33 | mView = new KABC::AddresseeView( this ); |
33 | mView->setFont( KABPrefs::instance()->mDetailsFont ); | 34 | mView->setFont( KABPrefs::instance()->mDetailsFont ); |
35 | connect(this, SIGNAL(printMyView()), | ||
36 | this , SLOT(printMe())); | ||
34 | } | 37 | } |
@@ -38,2 +41,7 @@ KABHtmlView::~KABHtmlView() | |||
38 | } | 41 | } |
42 | void KABHtmlView::printMe() | ||
43 | { | ||
44 | mView->printMe(); | ||
45 | |||
46 | } | ||
39 | 47 | ||
diff --git a/kaddressbook/details/look_html.h b/kaddressbook/details/look_html.h index 68a02d9..57eb56f 100644 --- a/kaddressbook/details/look_html.h +++ b/kaddressbook/details/look_html.h | |||
@@ -31,3 +31,3 @@ | |||
31 | namespace KABC { class Addressee; } | 31 | namespace KABC { class Addressee; } |
32 | namespace KPIM { class AddresseeView; } | 32 | namespace KABC { class AddresseeView; } |
33 | 33 | ||
@@ -51,6 +51,8 @@ class KABHtmlView : public KABBasicLook | |||
51 | */ | 51 | */ |
52 | void setAddressee( const KABC::Addressee& ); | 52 | void setAddressee( const KABC::Addressee& ); |
53 | public slots: | ||
54 | void printMe(); | ||
53 | 55 | ||
54 | private: | 56 | private: |
55 | KPIM::AddresseeView *mView; | 57 | KABC::AddresseeView *mView; |
56 | }; | 58 | }; |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4098dda..e61f65f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1879,14 +1879,11 @@ void KABCore::initActions() | |||
1879 | // file menu | 1879 | // file menu |
1880 | if ( mIsPart ) { | 1880 | |
1881 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | ||
1882 | SLOT( sendMail() ), actionCollection(), | ||
1883 | "kaddressbook_mail" ); | ||
1884 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | ||
1885 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | ||
1886 | |||
1887 | } else { | ||
1888 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1881 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1889 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1882 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1890 | } | 1883 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, |
1884 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | ||
1885 | |||
1891 | 1886 | ||
1887 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | ||
1888 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | ||
1892 | 1889 | ||
@@ -2141,2 +2138,4 @@ void KABCore::addActionsManually() | |||
2141 | mActionPrint->plug( fileMenu ); | 2138 | mActionPrint->plug( fileMenu ); |
2139 | mActionPrintDetails->plug( fileMenu ); | ||
2140 | fileMenu->insertSeparator(); | ||
2142 | #endif | 2141 | #endif |
@@ -2770,3 +2769,3 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
2770 | { | 2769 | { |
2771 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 2770 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
2772 | result = acd.executeD(localIsNew); | 2771 | result = acd.executeD(localIsNew); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 0d5891e..ecfe6e9 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -432,2 +432,3 @@ class KABCore : public QWidget, public KSyncInterface | |||
432 | KAction* mActionPrint; | 432 | KAction* mActionPrint; |
433 | KAction* mActionPrintDetails; | ||
433 | KAction* mActionNewContact; | 434 | KAction* mActionNewContact; |
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 8646136..8f31910 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -40,2 +40,8 @@ class QDropEvent; | |||
40 | 40 | ||
41 | #ifdef DESKTOP_VERSION | ||
42 | #include <qpaintdevicemetrics.h> | ||
43 | #include <qprinter.h> | ||
44 | #include <qpainter.h> | ||
45 | #endif | ||
46 | |||
41 | namespace KABC { class AddressBook; } | 47 | namespace KABC { class AddressBook; } |
@@ -152,2 +158,3 @@ class KAddressBookView : public QWidget | |||
152 | KABC::AddressBook *addressBook() const; | 158 | KABC::AddressBook *addressBook() const; |
159 | void printMyView() { emit printView() ;} | ||
153 | 160 | ||
@@ -178,2 +185,4 @@ class KAddressBookView : public QWidget | |||
178 | signals: | 185 | signals: |
186 | |||
187 | void printView(); | ||
179 | /** | 188 | /** |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 8bf9bb0..3ad2f74 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -159,3 +159,3 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
159 | mExtensionView->addColumn( i18n( "Description" ) ); | 159 | mExtensionView->addColumn( i18n( "Description" ) ); |
160 | mExtensionView->setMaximumHeight(80); | 160 | //mExtensionView->setMaximumHeight(80); |
161 | 161 | ||
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 771bec9..1e03dba 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -78,4 +78,5 @@ int main( int argc, char **argv ) | |||
78 | //US MainWindow m; | 78 | //US MainWindow m; |
79 | #ifndef DESKTOP_VERSION | ||
79 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 80 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
80 | 81 | #endif | |
81 | 82 | ||
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 272e1b0..dff9998 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -71,2 +71,3 @@ class ViewManager : public QWidget | |||
71 | public slots: | 71 | public slots: |
72 | void printView() { if (mActiveView) mActiveView->printMyView() ;} | ||
72 | void scrollUP(); | 73 | void scrollUP(); |
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 23b091c..e75810e 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -279,2 +279,29 @@ ContactListView::ContactListView(KAddressBookTableView *view, | |||
279 | } | 279 | } |
280 | void ContactListView::printMe() | ||
281 | { | ||
282 | #ifdef DESKTOP_VERSION | ||
283 | QPrinter printer; | ||
284 | if (!printer.setup() ) | ||
285 | return; | ||
286 | QPainter p; | ||
287 | p.begin ( &printer ); | ||
288 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | ||
289 | float dx, dy; | ||
290 | int wid = (m.width() * 9)/10; | ||
291 | dx = (float) wid/(float)contentsWidth (); | ||
292 | dy = (float)(m.height()) / (float)contentsHeight (); | ||
293 | float scale; | ||
294 | // scale to fit the width or height of the paper | ||
295 | if ( dx < dy ) | ||
296 | scale = dx; | ||
297 | else | ||
298 | scale = dy; | ||
299 | p.translate( m.width()/10,0 ); | ||
300 | p.scale( scale, scale ); | ||
301 | qDebug("scale %f ", scale); | ||
302 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | ||
303 | p.end(); | ||
304 | qDebug("Why does it not print??? "); | ||
305 | #endif | ||
306 | } | ||
280 | 307 | ||
diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h index fad7f38..9d1a672 100644 --- a/kaddressbook/views/contactlistview.h +++ b/kaddressbook/views/contactlistview.h | |||
@@ -107,2 +107,3 @@ protected slots: | |||
107 | public slots: | 107 | public slots: |
108 | void printMe(); | ||
108 | 109 | ||
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 2d7ed08..107be59 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -40,2 +40,3 @@ | |||
40 | 40 | ||
41 | |||
41 | #include "kaddressbookcardview.h" | 42 | #include "kaddressbookcardview.h" |
@@ -118,2 +119,28 @@ AddresseeCardView::~AddresseeCardView() | |||
118 | } | 119 | } |
120 | void AddresseeCardView::printMe() | ||
121 | { | ||
122 | #ifdef DESKTOP_VERSION | ||
123 | QPrinter printer; | ||
124 | if (!printer.setup() ) | ||
125 | return; | ||
126 | QPainter p; | ||
127 | p.begin ( &printer ); | ||
128 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | ||
129 | float dx, dy; | ||
130 | int wid = (m.width() * 9)/10; | ||
131 | dx = (float) wid/(float)contentsWidth (); | ||
132 | dy = (float)(m.height()) / (float)contentsHeight (); | ||
133 | float scale; | ||
134 | // scale to fit the width or height of the paper | ||
135 | if ( dx < dy ) | ||
136 | scale = dx; | ||
137 | else | ||
138 | scale = dy; | ||
139 | p.translate( m.width()/10,0 ); | ||
140 | p.scale( scale, scale ); | ||
141 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | ||
142 | p.end(); | ||
143 | repaint(); | ||
144 | #endif | ||
145 | } | ||
119 | 146 | ||
@@ -166,2 +193,4 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | |||
166 | this, SIGNAL(startDrag())); | 193 | this, SIGNAL(startDrag())); |
194 | connect(this, SIGNAL(printView()), | ||
195 | mCardView , SLOT(printMe())); | ||
167 | } | 196 | } |
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h index 8f22d54..2a71f7e 100644 --- a/kaddressbook/views/kaddressbookcardview.h +++ b/kaddressbook/views/kaddressbookcardview.h | |||
@@ -87,2 +87,4 @@ class AddresseeCardView : public CardView | |||
87 | ~AddresseeCardView(); | 87 | ~AddresseeCardView(); |
88 | public slots: | ||
89 | void printMe(); | ||
88 | 90 | ||
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 61703ee..ecd6f05 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -91,2 +91,4 @@ void KAddressBookTableView::reconstructListView() | |||
91 | 91 | ||
92 | connect(this, SIGNAL(printView()), | ||
93 | mListView , SLOT(printMe())); | ||
92 | //US set singleClick manually, because it is no global configparameter in embedded space | 94 | //US set singleClick manually, because it is no global configparameter in embedded space |
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 8d40ffe..89a2626 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp | |||
@@ -230,3 +230,3 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, | |||
230 | 230 | ||
231 | KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); | 231 | KABC::AddresseeView *view = new KABC::AddresseeView( page ); |
232 | view->setAddressee( addr ); | 232 | view->setAddressee( addr ); |
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; |