summaryrefslogtreecommitdiffabout
path: root/kaddressbook/details
authorzautrix <zautrix>2005-01-16 22:19:12 (UTC)
committer zautrix <zautrix>2005-01-16 22:19:12 (UTC)
commit507b362d42d5eed6277ad17422b6ba61acca636e (patch) (unidiff)
treed3d29451d37649b102c3e171e2927437925f8ce8 /kaddressbook/details
parenta704468d5fd02d30cf962c8b2d6815c7e9208e5d (diff)
downloadkdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.zip
kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.gz
kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.bz2
print AB
Diffstat (limited to 'kaddressbook/details') (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
5 files changed, 21 insertions, 4 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
@@ -49,64 +49,68 @@ ViewContainer::ViewContainer( QWidget *parent, const char* name )
49 //topLayout->setMargin( KDialog::marginHint() ); 49 //topLayout->setMargin( KDialog::marginHint() );
50 //topLayout->setSpacing( KDialog::spacingHint() ); 50 //topLayout->setSpacing( KDialog::spacingHint() );
51 topLayout->setMargin( 0 ); 51 topLayout->setMargin( 0 );
52 topLayout->setSpacing( 0 ); 52 topLayout->setSpacing( 0 );
53 53
54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); 54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout );
55 55
56 QLabel *label = new QLabel( i18n("Style:"), this ); 56 QLabel *label = new QLabel( i18n("Style:"), this );
57 styleLayout->addWidget( label ); 57 styleLayout->addWidget( label );
58 58
59 mStyleCombo = new QComboBox( this ); 59 mStyleCombo = new QComboBox( this );
60 styleLayout->addWidget( mStyleCombo ); 60 styleLayout->addWidget( mStyleCombo );
61 61
62 QFrame *frameRuler = new QFrame( this ); 62 QFrame *frameRuler = new QFrame( this );
63//US frameRuler->setFrameShape( QFrame::HLine ); 63//US frameRuler->setFrameShape( QFrame::HLine );
64//US frameRuler->setFrameShadow( QFrame::Sunken ); 64//US frameRuler->setFrameShadow( QFrame::Sunken );
65//US topLayout->addWidget( frameRuler ); 65//US topLayout->addWidget( frameRuler );
66 66
67 mDetailsStack = new QWidgetStack( this ); 67 mDetailsStack = new QWidgetStack( this );
68 topLayout->addWidget( mDetailsStack, 1 ); 68 topLayout->addWidget( mDetailsStack, 1 );
69 69
70 registerLooks(); 70 registerLooks();
71 71
72#if 1 72#if 1
73 // Hide detailed view selection combo box, because we currently have 73 // Hide detailed view selection combo box, because we currently have
74 // only one. Reenable it when there are more detailed views. 74 // only one. Reenable it when there are more detailed views.
75 label->hide(); 75 label->hide();
76 mStyleCombo->hide(); 76 mStyleCombo->hide();
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}
85 89
86void ViewContainer::registerLooks() 90void ViewContainer::registerLooks()
87{ 91{
88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); 92 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); 93// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
90 mStyleCombo->clear(); 94 mStyleCombo->clear();
91 95
92 for ( uint i = 0; i < mLookFactories.count(); ++i ) 96 for ( uint i = 0; i < mLookFactories.count(); ++i )
93 mStyleCombo->insertItem( mLookFactories.at( i )->description() ); 97 mStyleCombo->insertItem( mLookFactories.at( i )->description() );
94 98
95 if ( !mLookFactories.isEmpty() ) 99 if ( !mLookFactories.isEmpty() )
96 slotStyleSelected( 0 ); 100 slotStyleSelected( 0 );
97} 101}
98 102
99void ViewContainer::slotStyleSelected( int index ) 103void ViewContainer::slotStyleSelected( int index )
100{ 104{
101#ifndef KAB_EMBEDDED 105#ifndef KAB_EMBEDDED
102 KConfig *config = kapp->config(); 106 KConfig *config = kapp->config();
103#else //KAB_EMBEDDED 107#else //KAB_EMBEDDED
104 //US I hope I got the same config object as above expected. 108 //US I hope I got the same config object as above expected.
105 KConfig *config = KABPrefs::instance()->getConfig(); 109 KConfig *config = KABPrefs::instance()->getConfig();
106#endif //KAB_EMBEDDED 110#endif //KAB_EMBEDDED
107 KABC::Addressee addr; 111 KABC::Addressee addr;
108 112
109 if ( index >= 0 && index < mStyleCombo->count() ) { 113 if ( index >= 0 && index < mStyleCombo->count() ) {
110 if ( mCurrentLook != 0 ) { 114 if ( mCurrentLook != 0 ) {
111 mCurrentLook->saveSettings( config ); 115 mCurrentLook->saveSettings( config );
112 addr = mCurrentLook->addressee(); 116 addr = mCurrentLook->addressee();
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
@@ -22,64 +22,65 @@
22*/ 22*/
23 23
24#ifndef DETAILSVIEWCONTAINER_H 24#ifndef DETAILSVIEWCONTAINER_H
25#define DETAILSVIEWCONTAINER_H 25#define DETAILSVIEWCONTAINER_H
26 26
27#include <qptrlist.h> 27#include <qptrlist.h>
28 28
29#include "look_basic.h" 29#include "look_basic.h"
30 30
31class QComboBox; 31class QComboBox;
32class QWidgetStack; 32class QWidgetStack;
33 33
34class ViewContainer : public QWidget 34class ViewContainer : public QWidget
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 37
38 public: 38 public:
39 ViewContainer( QWidget *parent = 0, const char* name = 0 ); 39 ViewContainer( QWidget *parent = 0, const char* name = 0 );
40 40
41 /** 41 /**
42 Return the look currently selected. If there is none, it 42 Return the look currently selected. If there is none, it
43 returns zero. Do not use this pointer to store a reference 43 returns zero. Do not use this pointer to store a reference
44 to a look, the user might select another one (e.g., create 44 to a look, the user might select another one (e.g., create
45 a new object) at any time. 45 a new object) at any time.
46 */ 46 */
47 KABBasicLook *currentLook(); 47 KABBasicLook *currentLook();
48 /** 48 /**
49 Return the contact currently displayed. 49 Return the contact currently displayed.
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 );
58 59
59 /** 60 /**
60 Set read-write state. 61 Set read-write state.
61 */ 62 */
62 void setReadOnly( bool state ); 63 void setReadOnly( bool state );
63 64
64 signals: 65 signals:
65 /** 66 /**
66 The contact has been changed. 67 The contact has been changed.
67 */ 68 */
68 void addresseeChanged(); 69 void addresseeChanged();
69 70
70 /** 71 /**
71 The user acticated the email address displayed. This may happen 72 The user acticated the email address displayed. This may happen
72 by, for example, clicking on the displayed mailto-URL. 73 by, for example, clicking on the displayed mailto-URL.
73 */ 74 */
74 void sendEmail( const QString& ); 75 void sendEmail( const QString& );
75 76
76 /** 77 /**
77 The user activated one of the displayed HTTP URLs. For example 78 The user activated one of the displayed HTTP URLs. For example
78 by clicking on the displayed homepage address. 79 by clicking on the displayed homepage address.
79 */ 80 */
80 void browse( const QString& ); 81 void browse( const QString& );
81 82
82 protected: 83 protected:
83 /** 84 /**
84 A style has been selected. Overloaded from base class. 85 A style has been selected. Overloaded from base class.
85 */ 86 */
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
@@ -46,66 +46,68 @@ class KABBasicLook : public QVBox
46 Q_OBJECT 46 Q_OBJECT
47 47
48 public: 48 public:
49 /** 49 /**
50 The constructor. 50 The constructor.
51 */ 51 */
52 KABBasicLook( QWidget *parent = 0, const char *name = 0 ); 52 KABBasicLook( QWidget *parent = 0, const char *name = 0 );
53 53
54 /** 54 /**
55 Set the entry. It will be displayed automatically. 55 Set the entry. It will be displayed automatically.
56 */ 56 */
57 virtual void setAddressee( const KABC::Addressee& addressee ); 57 virtual void setAddressee( const KABC::Addressee& addressee );
58 58
59 /** 59 /**
60 Get the current entry. 60 Get the current entry.
61 */ 61 */
62 virtual KABC::Addressee addressee(); 62 virtual KABC::Addressee addressee();
63 63
64 /** 64 /**
65 Configure the view from the configuration file. 65 Configure the view from the configuration file.
66 */ 66 */
67 virtual void restoreSettings( KConfig* ); 67 virtual void restoreSettings( KConfig* );
68 68
69 /** 69 /**
70 Save the view settings to the configuration file. 70 Save the view settings to the configuration file.
71 */ 71 */
72 virtual void saveSettings( KConfig* ); 72 virtual void saveSettings( KConfig* );
73 73
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();
84 86
85 /** 87 /**
86 This signal indicates that the entry needs to be changed 88 This signal indicates that the entry needs to be changed
87 immidiately in the database. This might be due to changes in 89 immidiately in the database. This might be due to changes in
88 values that are available in menus. 90 values that are available in menus.
89 */ 91 */
90 void saveMe(); 92 void saveMe();
91 93
92 /** 94 /**
93 The user acticated the email address displayed. This may happen 95 The user acticated the email address displayed. This may happen
94 by, for example, clicking on the displayed mailto-URL. 96 by, for example, clicking on the displayed mailto-URL.
95 */ 97 */
96 void sendEmail( const QString &email ); 98 void sendEmail( const QString &email );
97 99
98 /** 100 /**
99 The user activated one of the displayed HTTP URLs. For example 101 The user activated one of the displayed HTTP URLs. For example
100 by clicking on the displayed homepage address. 102 by clicking on the displayed homepage address.
101 */ 103 */
102 void browse( const QString &url ); 104 void browse( const QString &url );
103 105
104 public slots: 106 public slots:
105 /** 107 /**
106 Set read-write state. 108 Set read-write state.
107 */ 109 */
108 virtual void setReadOnly( bool state ); 110 virtual void setReadOnly( bool state );
109 111
110 private: 112 private:
111 KABC::Addressee mAddressee; 113 KABC::Addressee mAddressee;
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
@@ -1,48 +1,56 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <addresseeview.h> 24#include <addresseeview.h>
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 );
43 mView->setAddressee( addr ); 51 mView->setAddressee( addr );
44} 52}
45 53
46#ifndef KAB_EMBEDDED 54#ifndef KAB_EMBEDDED
47#include "look_html.moc" 55#include "look_html.moc"
48#endif //KAB_EMBEDDED 56#endif //KAB_EMBEDDED
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
@@ -1,75 +1,77 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef LOOK_HTML_H 24#ifndef LOOK_HTML_H
25#define LOOK_HTML_H 25#define LOOK_HTML_H
26 26
27#include <klocale.h> 27#include <klocale.h>
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
37 37
38 public: 38 public:
39 /** 39 /**
40 The constructor. 40 The constructor.
41 */ 41 */
42 KABHtmlView( QWidget *parent = 0, const char* name = 0 ); 42 KABHtmlView( QWidget *parent = 0, const char* name = 0 );
43 43
44 /** 44 /**
45 The virtual destructor. 45 The virtual destructor.
46 */ 46 */
47 virtual ~KABHtmlView(); 47 virtual ~KABHtmlView();
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{
60 public: 62 public:
61 KABHtmlViewFactory( QWidget *parent = 0, const char *name = 0 ) 63 KABHtmlViewFactory( QWidget *parent = 0, const char *name = 0 )
62 : KABLookFactory( parent, name ) {} 64 : KABLookFactory( parent, name ) {}
63 65
64 KABBasicLook *create() 66 KABBasicLook *create()
65 { 67 {
66 return new KABHtmlView( mParent, mName ); 68 return new KABHtmlView( mParent, mName );
67 } 69 }
68 70
69 QString description() 71 QString description()
70 { 72 {
71 return i18n( "HTML table style." ); 73 return i18n( "HTML table style." );
72 } 74 }
73}; 75};
74 76
75#endif 77#endif