summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore 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.h8
-rw-r--r--kaddressbook/kabcore.cpp21
-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, 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
@@ -37,8 +37,13 @@
#include <qapplication.h>
#include <qpushbutton.h>
+#ifdef DESKTOP_VERSION
+#include <qpaintdevicemetrics.h>
+#include <qprinter.h>
+#include <qpainter.h>
+#endif
#include "externalapphandler.h"
-#include "addresseeview.h"
+#include <kabc/addresseeview.h>
@@ -50,8 +55,7 @@
//US static int kphoneInstalled = 0;
-using namespace KPIM;
+using namespace KABC;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
-//US : KTextBrowser( parent, name )
: QTextBrowser( parent, name )
@@ -68,5 +72,29 @@ 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)
{
@@ -212,5 +240,5 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
if ( true /*!mAddressee.organization().isEmpty()*/ ) {
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
@@ -29,9 +29,10 @@
#include <qtextbrowser.h>
-namespace KPIM {
+namespace KABC {
//US class AddresseeView : public KTextBrowser
class AddresseeView : public QTextBrowser
{
+
public:
AddresseeView( QWidget *parent = 0, const char *name = 0 );
@@ -48,4 +49,5 @@ class AddresseeView : public QTextBrowser
*/
//KABC::Addressee addressee() const;
+ void printMe();
private:
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
@@ -79,4 +79,8 @@ 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
@@ -52,4 +52,5 @@ class ViewContainer : public QWidget
public slots:
+ void printView();
/**
Set the contact currently displayed.
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
@@ -76,6 +76,8 @@ class KABBasicLook : public QVBox
*/
bool isReadOnly() const;
+ void printView(){ emit printMyView();}
signals:
+ void printMyView();
/**
This signal is emitted when the user changed the entry.
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
@@ -27,9 +27,12 @@
#include <qscrollview.h>
#include "kabprefs.h"
+#include <kabc/addresseeview.h>
KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
: KABBasicLook( parent, name )
{
- mView = new KPIM::AddresseeView( this );
+ mView = new KABC::AddresseeView( this );
mView->setFont( KABPrefs::instance()->mDetailsFont );
+ connect(this, SIGNAL(printMyView()),
+ this , SLOT(printMe()));
}
@@ -37,4 +40,9 @@ KABHtmlView::~KABHtmlView()
{
}
+void KABHtmlView::printMe()
+{
+ mView->printMe();
+
+}
void KABHtmlView::setAddressee( const KABC::Addressee &addr )
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
@@ -30,5 +30,5 @@
namespace KABC { class Addressee; }
-namespace KPIM { class AddresseeView; }
+namespace KABC { class AddresseeView; }
class KABHtmlView : public KABBasicLook
@@ -50,8 +50,10 @@ class KABHtmlView : public KABBasicLook
Set the addressee.
*/
- void setAddressee( const KABC::Addressee& );
+ 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
@@ -1878,16 +1878,13 @@ 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,
@@ -2140,4 +2137,6 @@ void KABCore::addActionsManually()
#ifdef DESKTOP_VERSION
mActionPrint->plug( fileMenu );
+ mActionPrintDetails->plug( fileMenu );
+ fileMenu->insertSeparator();
#endif
mActionMail->plug( fileMenu );
@@ -2769,5 +2768,5 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
//qDebug("conflict! ************************************** ");
{
- KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
+ KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this );
result = acd.executeD(localIsNew);
return result;
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 0d5891e..ecfe6e9 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -431,4 +431,5 @@ class KABCore : public QWidget, public KSyncInterface
KAction *mActionExport2phone;
KAction* mActionPrint;
+ KAction* mActionPrintDetails;
KAction* mActionNewContact;
KAction *mActionSave;
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 8646136..8f31910 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -39,4 +39,10 @@ class QDropEvent;
#include "filter.h"
+#ifdef DESKTOP_VERSION
+#include <qpaintdevicemetrics.h>
+#include <qprinter.h>
+#include <qpainter.h>
+#endif
+
namespace KABC { class AddressBook; }
@@ -151,4 +157,5 @@ class KAddressBookView : public QWidget
*/
KABC::AddressBook *addressBook() const;
+ void printMyView() { emit printView() ;}
public slots:
@@ -177,4 +184,6 @@ class KAddressBookView : public QWidget
signals:
+
+ void printView();
/**
This signal should be emitted by a subclass whenever an addressee
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
@@ -158,5 +158,5 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
mExtensionView->addColumn( i18n( "Name" ) );
mExtensionView->addColumn( i18n( "Description" ) );
- mExtensionView->setMaximumHeight(80);
+ //mExtensionView->setMaximumHeight(80);
boxLayout->addWidget( mExtensionView );
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 771bec9..1e03dba 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -77,6 +77,7 @@ int main( int argc, char **argv )
KAddressBookMain m ;
//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
@@ -70,4 +70,5 @@ class ViewManager : public QWidget
public slots:
+ void printView() { if (mActiveView) mActiveView->printMyView() ;}
void scrollUP();
void scrollDOWN();
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
@@ -278,4 +278,31 @@ ContactListView::ContactListView(KAddressBookTableView *view,
new DynamicTip( this );
}
+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
+}
void ContactListView::setAlternateColor(const QColor &m_AlternateColor)
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
@@ -106,4 +106,5 @@ protected slots:
public slots:
+ void printMe();
signals:
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
@@ -39,4 +39,5 @@
#include "viewmanager.h"
+
#include "kaddressbookcardview.h"
@@ -117,4 +118,30 @@ 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
+}
@@ -165,4 +192,6 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
connect(mCardView, SIGNAL(startAddresseeDrag()),
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
@@ -86,4 +86,6 @@ class AddresseeCardView : public CardView
AddresseeCardView(QWidget *parent, const char *name = 0);
~AddresseeCardView();
+public slots:
+ void printMe();
signals:
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
@@ -90,4 +90,6 @@ void KAddressBookTableView::reconstructListView()
mListView = new ContactListView( this, addressBook(), viewWidget() );
+ connect(this, SIGNAL(printView()),
+ mListView , SLOT(printMe()));
//US set singleClick manually, because it is no global configparameter in embedded space
mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick);
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 8d40ffe..89a2626 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -229,5 +229,5 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
- 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
@@ -88,5 +88,5 @@ void KOEventViewer::setSource(const QString& n)
dia.setCaption( i18n("Details of attendee") );
QVBoxLayout lay ( &dia );
- KPIM::AddresseeView av ( &dia );
+ KABC::AddresseeView av ( &dia );
av.setAddressee( (*it) );
lay.addWidget( &av );
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 219f7c3..7166a01 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -25,5 +25,7 @@
#include <qapplication.h>
-
+#ifdef DESKTOP_VERSION
+#include <qpaintdevicemetrics.h>
+#endif
#include <kglobal.h>
#include <klocale.h>
@@ -57,4 +59,29 @@ 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
+}
KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
@@ -115,16 +142,5 @@ 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
@@ -35,7 +35,8 @@ class WhatsNextTextBrowser : public QTextBrowser {
Q_OBJECT
public:
- WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}
+ WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {};
void setSource(const QString &);
+ void printMe();
signals:
@@ -89,5 +90,5 @@ class KOWhatsNextView : public KOrg::BaseView
//void createEventViewer();
QTimer* mTimer;
- QTextBrowser *mView;
+ WhatsNextTextBrowser *mView;
QString mText;
// QLabel *mDateLabel;