summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-16 22:19:12 (UTC)
committer zautrix <zautrix>2005-01-16 22:19:12 (UTC)
commit507b362d42d5eed6277ad17422b6ba61acca636e (patch) (side-by-side diff)
treed3d29451d37649b102c3e171e2927437925f8ce8
parenta704468d5fd02d30cf962c8b2d6815c7e9208e5d (diff)
downloadkdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.zip
kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.gz
kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.bz2
print AB
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/addresseeview.cpp38
-rw-r--r--kabc/addresseeview.h4
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp4
-rw-r--r--kaddressbook/details/detailsviewcontainer.h1
-rw-r--r--kaddressbook/details/look_basic.h2
-rw-r--r--kaddressbook/details/look_html.cpp10
-rw-r--r--kaddressbook/details/look_html.h6
-rw-r--r--kaddressbook/kabcore.cpp19
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--kaddressbook/kaddressbookview.h9
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp2
-rw-r--r--kaddressbook/mainembedded.cpp3
-rw-r--r--kaddressbook/viewmanager.h1
-rw-r--r--kaddressbook/views/contactlistview.cpp27
-rw-r--r--kaddressbook/views/contactlistview.h1
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp29
-rw-r--r--kaddressbook/views/kaddressbookcardview.h2
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp2
-rw-r--r--kaddressbook/xxportmanager.cpp2
-rw-r--r--korganizer/koeventviewer.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp42
-rw-r--r--korganizer/kowhatsnextview.h5
22 files changed, 174 insertions, 38 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 @@
#include <qpushbutton.h>
+#ifdef DESKTOP_VERSION
+#include <qpaintdevicemetrics.h>
+#include <qprinter.h>
+#include <qpainter.h>
+#endif
@@ -41,3 +46,3 @@
#include "externalapphandler.h"
-#include "addresseeview.h"
+#include <kabc/addresseeview.h>
@@ -51,6 +56,5 @@
-using namespace KPIM;
+using namespace KABC;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
-//US : KTextBrowser( parent, name )
: QTextBrowser( parent, name )
@@ -69,3 +73,27 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name )
}
-
+void AddresseeView::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 AddresseeView::setSource(const QString& n)
@@ -213,3 +241,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
aOrga = "<tr>"
- "<td align=\"left\">" + mAddressee.organization() + "</td>" ;
+ "<td align=\"left\">" + mAddressee.organization() + "</td>"
"</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 @@
-namespace KPIM {
+namespace KABC {
@@ -35,2 +35,3 @@ class AddresseeView : public QTextBrowser
{
+
public:
@@ -49,2 +50,3 @@ class AddresseeView : public QTextBrowser
//KABC::Addressee addressee() const;
+ void printMe();
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 )
+void ViewContainer::printView()
+{
+ mCurrentLook->printView();
+}
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
public slots:
+ void printView();
/**
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
bool isReadOnly() const;
+ void printView(){ emit printMyView();}
signals:
+ void printMyView();
/**
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 @@
#include "kabprefs.h"
+#include <kabc/addresseeview.h>
KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
@@ -31,4 +32,6 @@ KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
{
- mView = new KPIM::AddresseeView( this );
+ mView = new KABC::AddresseeView( this );
mView->setFont( KABPrefs::instance()->mDetailsFont );
+ connect(this, SIGNAL(printMyView()),
+ this , SLOT(printMe()));
}
@@ -38,2 +41,7 @@ KABHtmlView::~KABHtmlView()
}
+void KABHtmlView::printMe()
+{
+ mView->printMe();
+
+}
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 @@
namespace KABC { class Addressee; }
-namespace KPIM { class AddresseeView; }
+namespace KABC { class AddresseeView; }
@@ -52,5 +52,7 @@ class KABHtmlView : public KABBasicLook
void setAddressee( const KABC::Addressee& );
+ public slots:
+ void printMe();
private:
- KPIM::AddresseeView *mView;
+ KABC::AddresseeView *mView;
};
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4098dda..e61f65f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1879,15 +1879,12 @@ void KABCore::initActions()
// file menu
- if ( mIsPart ) {
- mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
- SLOT( sendMail() ), actionCollection(),
- "kaddressbook_mail" );
- mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
- SLOT( print() ), actionCollection(), "kaddressbook_print" );
- } else {
mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
- mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
- }
+ //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
+ mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
+ SLOT( printView() ), actionCollection(), "kaddressbook_print" );
+ mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
+ SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
+
mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
@@ -2141,2 +2138,4 @@ void KABCore::addActionsManually()
mActionPrint->plug( fileMenu );
+ mActionPrintDetails->plug( fileMenu );
+ fileMenu->insertSeparator();
#endif
@@ -2770,3 +2769,3 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
{
- KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
+ KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this );
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
KAction* mActionPrint;
+ KAction* mActionPrintDetails;
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;
+#ifdef DESKTOP_VERSION
+#include <qpaintdevicemetrics.h>
+#include <qprinter.h>
+#include <qpainter.h>
+#endif
+
namespace KABC { class AddressBook; }
@@ -152,2 +158,3 @@ class KAddressBookView : public QWidget
KABC::AddressBook *addressBook() const;
+ void printMyView() { emit printView() ;}
@@ -178,2 +185,4 @@ class KAddressBookView : public QWidget
signals:
+
+ void printView();
/**
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 *
mExtensionView->addColumn( i18n( "Description" ) );
- mExtensionView->setMaximumHeight(80);
+ //mExtensionView->setMaximumHeight(80);
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 )
//US MainWindow m;
+#ifndef DESKTOP_VERSION
QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
-
+#endif
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
public slots:
+ void printView() { if (mActiveView) mActiveView->printMyView() ;}
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,
}
+void ContactListView::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 );
+ qDebug("scale %f ", scale);
+ drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
+ p.end();
+ qDebug("Why does it not print??? ");
+#endif
+}
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:
public slots:
+ void printMe();
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 @@
+
#include "kaddressbookcardview.h"
@@ -118,2 +119,28 @@ AddresseeCardView::~AddresseeCardView()
}
+void AddresseeCardView::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();
+ repaint();
+#endif
+}
@@ -166,2 +193,4 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
this, SIGNAL(startDrag()));
+ connect(this, SIGNAL(printView()),
+ mCardView , SLOT(printMe()));
}
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
~AddresseeCardView();
+public slots:
+ void printMe();
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()
+ connect(this, SIGNAL(printView()),
+ mListView , SLOT(printMe()));
//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,
- KPIM::AddresseeView *view = new KPIM::AddresseeView( page );
+ KABC::AddresseeView *view = new KABC::AddresseeView( page );
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)
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;