summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-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
17 files changed, 107 insertions, 18 deletions
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
@@ -77,8 +77,12 @@ ViewContainer::ViewContainer( QWidget *parent, const char* name )
77 frameRuler->hide(); 77 frameRuler->hide();
78#endif 78#endif
79} 79}
80 80
81void ViewContainer::printView()
82{
83 mCurrentLook->printView();
84}
81KABBasicLook *ViewContainer::currentLook() 85KABBasicLook *ViewContainer::currentLook()
82{ 86{
83 return mCurrentLook; 87 return mCurrentLook;
84} 88}
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
@@ -50,8 +50,9 @@ class ViewContainer : public QWidget
50 */ 50 */
51 KABC::Addressee addressee(); 51 KABC::Addressee addressee();
52 52
53 public slots: 53 public slots:
54 void printView();
54 /** 55 /**
55 Set the contact currently displayed. 56 Set the contact currently displayed.
56 */ 57 */
57 void setAddressee( const KABC::Addressee& addressee ); 58 void setAddressee( const KABC::Addressee& addressee );
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
@@ -74,10 +74,12 @@ class KABBasicLook : public QVBox
74 /** 74 /**
75 Retrieve read-write state. 75 Retrieve read-write state.
76 */ 76 */
77 bool isReadOnly() const; 77 bool isReadOnly() const;
78 void printView(){ emit printMyView();}
78 79
79 signals: 80 signals:
81 void printMyView();
80 /** 82 /**
81 This signal is emitted when the user changed the entry. 83 This signal is emitted when the user changed the entry.
82 */ 84 */
83 void entryChanged(); 85 void entryChanged();
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
@@ -25,18 +25,26 @@
25 25
26#include "look_html.h" 26#include "look_html.h"
27#include <qscrollview.h> 27#include <qscrollview.h>
28#include "kabprefs.h" 28#include "kabprefs.h"
29#include <kabc/addresseeview.h>
29KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) 30KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
30 : KABBasicLook( parent, name ) 31 : KABBasicLook( parent, 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}
35 38
36KABHtmlView::~KABHtmlView() 39KABHtmlView::~KABHtmlView()
37{ 40{
38} 41}
42void KABHtmlView::printMe()
43{
44 mView->printMe();
45
46}
39 47
40void KABHtmlView::setAddressee( const KABC::Addressee &addr ) 48void KABHtmlView::setAddressee( const KABC::Addressee &addr )
41{ 49{
42 mView->setFont( KABPrefs::instance()->mDetailsFont ); 50 mView->setFont( KABPrefs::instance()->mDetailsFont );
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
@@ -28,9 +28,9 @@
28 28
29#include "look_basic.h" 29#include "look_basic.h"
30 30
31namespace KABC { class Addressee; } 31namespace KABC { class Addressee; }
32namespace KPIM { class AddresseeView; } 32namespace KABC { class AddresseeView; }
33 33
34class KABHtmlView : public KABBasicLook 34class KABHtmlView : public KABBasicLook
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
@@ -48,12 +48,14 @@ class KABHtmlView : public KABBasicLook
48 48
49 /** 49 /**
50 Set the addressee. 50 Set the addressee.
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};
57 59
58class KABHtmlViewFactory : public KABLookFactory 60class KABHtmlViewFactory : public KABLookFactory
59{ 61{
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4098dda..e61f65f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1876,20 +1876,17 @@ void KABCore::initActions()
1876 SLOT( clipboardDataChanged() ) ); 1876 SLOT( clipboardDataChanged() ) );
1877#endif //KAB_EMBEDDED 1877#endif //KAB_EMBEDDED
1878 1878
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
1893 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1890 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1894 SLOT( save() ), actionCollection(), "file_sync" ); 1891 SLOT( save() ), actionCollection(), "file_sync" );
1895 1892
@@ -2138,8 +2135,10 @@ void KABCore::addActionsManually()
2138 2135
2139 //US Now connect the actions with the menue entries. 2136 //US Now connect the actions with the menue entries.
2140#ifdef DESKTOP_VERSION 2137#ifdef DESKTOP_VERSION
2141 mActionPrint->plug( fileMenu ); 2138 mActionPrint->plug( fileMenu );
2139 mActionPrintDetails->plug( fileMenu );
2140 fileMenu->insertSeparator();
2142#endif 2141#endif
2143 mActionMail->plug( fileMenu ); 2142 mActionMail->plug( fileMenu );
2144 fileMenu->insertSeparator(); 2143 fileMenu->insertSeparator();
2145 2144
@@ -2767,9 +2766,9 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2767 return 2; 2766 return 2;
2768 localIsNew = localMod >= remoteMod; 2767 localIsNew = localMod >= remoteMod;
2769 //qDebug("conflict! ************************************** "); 2768 //qDebug("conflict! ************************************** ");
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);
2773 return result; 2772 return result;
2774 } 2773 }
2775 break; 2774 break;
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 0d5891e..ecfe6e9 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -429,8 +429,9 @@ class KABCore : public QWidget, public KSyncInterface
429 KAction *mActionBeam; 429 KAction *mActionBeam;
430 KToggleAction *mActionBR; 430 KToggleAction *mActionBR;
431 KAction *mActionExport2phone; 431 KAction *mActionExport2phone;
432 KAction* mActionPrint; 432 KAction* mActionPrint;
433 KAction* mActionPrintDetails;
433 KAction* mActionNewContact; 434 KAction* mActionNewContact;
434 KAction *mActionSave; 435 KAction *mActionSave;
435 KAction *mActionEditAddressee; 436 KAction *mActionEditAddressee;
436 KAction *mActionMailVCard; 437 KAction *mActionMailVCard;
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 8646136..8f31910 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -37,8 +37,14 @@ class QDropEvent;
37 37
38#include "viewconfigurewidget.h" 38#include "viewconfigurewidget.h"
39#include "filter.h" 39#include "filter.h"
40 40
41#ifdef DESKTOP_VERSION
42#include <qpaintdevicemetrics.h>
43#include <qprinter.h>
44#include <qpainter.h>
45#endif
46
41namespace KABC { class AddressBook; } 47namespace KABC { class AddressBook; }
42 48
43/** 49/**
44 Base class for all views in kaddressbook. This class implements 50 Base class for all views in kaddressbook. This class implements
@@ -149,8 +155,9 @@ class KAddressBookView : public QWidget
149 /** 155 /**
150 @return The address book. 156 @return The address book.
151 */ 157 */
152 KABC::AddressBook *addressBook() const; 158 KABC::AddressBook *addressBook() const;
159 void printMyView() { emit printView() ;}
153 160
154 public slots: 161 public slots:
155 /** 162 /**
156 Must be overloaded in subclasses to refresh the view. 163 Must be overloaded in subclasses to refresh the view.
@@ -175,8 +182,10 @@ class KAddressBookView : public QWidget
175 virtual void setSelected( QString uid, bool selected) = 0; 182 virtual void setSelected( QString uid, bool selected) = 0;
176#endif //KAB_EMBEDDED 183#endif //KAB_EMBEDDED
177 184
178 signals: 185 signals:
186
187 void printView();
179 /** 188 /**
180 This signal should be emitted by a subclass whenever an addressee 189 This signal should be emitted by a subclass whenever an addressee
181 is modified. 190 is modified.
182 */ 191 */
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
@@ -156,9 +156,9 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
156 mExtensionView = new KListView( groupBox ); 156 mExtensionView = new KListView( groupBox );
157 mExtensionView->setAllColumnsShowFocus( true ); 157 mExtensionView->setAllColumnsShowFocus( true );
158 mExtensionView->addColumn( i18n( "Name" ) ); 158 mExtensionView->addColumn( i18n( "Name" ) );
159 mExtensionView->addColumn( i18n( "Description" ) ); 159 mExtensionView->addColumn( i18n( "Description" ) );
160 mExtensionView->setMaximumHeight(80); 160 //mExtensionView->setMaximumHeight(80);
161 161
162 boxLayout->addWidget( mExtensionView ); 162 boxLayout->addWidget( mExtensionView );
163 163
164 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 164 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 771bec9..1e03dba 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -75,10 +75,11 @@ int main( int argc, char **argv )
75 // init language 75 // init language
76 KPimGlobalPrefs::instance()->setGlobalConfig(); 76 KPimGlobalPrefs::instance()->setGlobalConfig();
77 KAddressBookMain m ; 77 KAddressBookMain m ;
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
82 83
83#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
84 a.showMainWidget( &m ); 85 a.showMainWidget( &m );
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h
index 272e1b0..dff9998 100644
--- a/kaddressbook/viewmanager.h
+++ b/kaddressbook/viewmanager.h
@@ -68,8 +68,9 @@ class ViewManager : public QWidget
68 void setListSelected(QStringList); 68 void setListSelected(QStringList);
69 void setFocusAV(); 69 void setFocusAV();
70 70
71 public slots: 71 public slots:
72 void printView() { if (mActiveView) mActiveView->printMyView() ;}
72 void scrollUP(); 73 void scrollUP();
73 void scrollDOWN(); 74 void scrollDOWN();
74 75
75//US void setSelected( const QString &uid = QString::null, bool selected = true ); 76//US void setSelected( const QString &uid = QString::null, bool selected = true );
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
@@ -276,8 +276,35 @@ ContactListView::ContactListView(KAddressBookTableView *view,
276 276
277 277
278 new DynamicTip( this ); 278 new DynamicTip( this );
279} 279}
280void 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
281void ContactListView::setAlternateColor(const QColor &m_AlternateColor) 308void ContactListView::setAlternateColor(const QColor &m_AlternateColor)
282{ 309{
283 mAlternateColor = m_AlternateColor; 310 mAlternateColor = 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
@@ -104,8 +104,9 @@ protected:
104protected slots: 104protected slots:
105 void itemDropped(QDropEvent *e); 105 void itemDropped(QDropEvent *e);
106 106
107public slots: 107public slots:
108 void printMe();
108 109
109signals: 110signals:
110 void startAddresseeDrag(); 111 void startAddresseeDrag();
111 void addresseeDropped(QDropEvent *); 112 void addresseeDropped(QDropEvent *);
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
@@ -37,8 +37,9 @@
37 37
38#include "kabprefs.h" 38#include "kabprefs.h"
39#include "viewmanager.h" 39#include "viewmanager.h"
40 40
41
41#include "kaddressbookcardview.h" 42#include "kaddressbookcardview.h"
42 43
43#ifndef KAB_EMBEDDED 44#ifndef KAB_EMBEDDED
44extern "C" { 45extern "C" {
@@ -115,8 +116,34 @@ AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name)
115 116
116AddresseeCardView::~AddresseeCardView() 117AddresseeCardView::~AddresseeCardView()
117{ 118{
118} 119}
120void 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
120 147
121void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) 148void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e)
122{ 149{
@@ -163,8 +190,10 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
163 connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), 190 connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)),
164 this, SIGNAL(dropped(QDropEvent*))); 191 this, SIGNAL(dropped(QDropEvent*)));
165 connect(mCardView, SIGNAL(startAddresseeDrag()), 192 connect(mCardView, SIGNAL(startAddresseeDrag()),
166 this, SIGNAL(startDrag())); 193 this, SIGNAL(startDrag()));
194 connect(this, SIGNAL(printView()),
195 mCardView , SLOT(printMe()));
167} 196}
168 197
169KAddressBookCardView::~KAddressBookCardView() 198KAddressBookCardView::~KAddressBookCardView()
170{ 199{
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
@@ -84,8 +84,10 @@ class AddresseeCardView : public CardView
84 Q_OBJECT 84 Q_OBJECT
85 public: 85 public:
86 AddresseeCardView(QWidget *parent, const char *name = 0); 86 AddresseeCardView(QWidget *parent, const char *name = 0);
87 ~AddresseeCardView(); 87 ~AddresseeCardView();
88public slots:
89 void printMe();
88 90
89 signals: 91 signals:
90 void startAddresseeDrag(); 92 void startAddresseeDrag();
91 void addresseeDropped(QDropEvent *); 93 void addresseeDropped(QDropEvent *);
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
@@ -88,8 +88,10 @@ void KAddressBookTableView::reconstructListView()
88 } 88 }
89 89
90 mListView = new ContactListView( this, addressBook(), viewWidget() ); 90 mListView = new ContactListView( this, addressBook(), viewWidget() );
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
93 mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); 95 mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick);
94 96
95 // Add the columns 97 // Add the columns
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 8d40ffe..89a2626 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -227,9 +227,9 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
227{ 227{
228 QWidget *page = plainPage(); 228 QWidget *page = plainPage();
229 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); 229 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
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 );
233 233
234 layout->addWidget( view ); 234 layout->addWidget( view );
235 235