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 /kaddressbook/details | |
parent | a704468d5fd02d30cf962c8b2d6815c7e9208e5d (diff) | |
download | kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.zip kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.gz kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.bz2 |
print AB
-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 |
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 | |||
@@ -1,160 +1,164 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> | 3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@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 <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | 29 | ||
30 | #include <kapplication.h> | 30 | #include <kapplication.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kdialog.h> | 32 | #include <kdialog.h> |
33 | 33 | ||
34 | #include "look_basic.h" | 34 | #include "look_basic.h" |
35 | //#include "look_details.h" | 35 | //#include "look_details.h" |
36 | #include "look_html.h" | 36 | #include "look_html.h" |
37 | 37 | ||
38 | #ifdef KAB_EMBEDDED | 38 | #ifdef KAB_EMBEDDED |
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | #endif //KAB_EMBEDDED | 40 | #endif //KAB_EMBEDDED |
41 | 41 | ||
42 | 42 | ||
43 | #include "detailsviewcontainer.h" | 43 | #include "detailsviewcontainer.h" |
44 | 44 | ||
45 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) | 45 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) |
46 | : QWidget( parent, name ), mCurrentLook( 0 ) | 46 | : QWidget( parent, name ), mCurrentLook( 0 ) |
47 | { | 47 | { |
48 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 48 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
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 | ||
81 | void ViewContainer::printView() | ||
82 | { | ||
83 | mCurrentLook->printView(); | ||
84 | } | ||
81 | KABBasicLook *ViewContainer::currentLook() | 85 | KABBasicLook *ViewContainer::currentLook() |
82 | { | 86 | { |
83 | return mCurrentLook; | 87 | return mCurrentLook; |
84 | } | 88 | } |
85 | 89 | ||
86 | void ViewContainer::registerLooks() | 90 | void 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 | ||
99 | void ViewContainer::slotStyleSelected( int index ) | 103 | void 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(); |
113 | 117 | ||
114 | delete mCurrentLook; | 118 | delete mCurrentLook; |
115 | mCurrentLook = 0; | 119 | mCurrentLook = 0; |
116 | } | 120 | } |
117 | 121 | ||
118 | KABLookFactory *factory = mLookFactories.at( index ); | 122 | KABLookFactory *factory = mLookFactories.at( index ); |
119 | 123 | ||
120 | mCurrentLook = factory->create(); | 124 | mCurrentLook = factory->create(); |
121 | mDetailsStack->raiseWidget( mCurrentLook ); | 125 | mDetailsStack->raiseWidget( mCurrentLook ); |
122 | 126 | ||
123 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, | 127 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, |
124 | SIGNAL( sendEmail( const QString& ) ) ); | 128 | SIGNAL( sendEmail( const QString& ) ) ); |
125 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, | 129 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, |
126 | SIGNAL( browse( const QString& ) ) ); | 130 | SIGNAL( browse( const QString& ) ) ); |
127 | } | 131 | } |
128 | 132 | ||
129 | mCurrentLook->restoreSettings( config ); | 133 | mCurrentLook->restoreSettings( config ); |
130 | mCurrentLook->setAddressee( addr ); | 134 | mCurrentLook->setAddressee( addr ); |
131 | } | 135 | } |
132 | 136 | ||
133 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) | 137 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) |
134 | { | 138 | { |
135 | if ( mCurrentLook != 0 ) { | 139 | if ( mCurrentLook != 0 ) { |
136 | mCurrentAddressee = addressee; | 140 | mCurrentAddressee = addressee; |
137 | mCurrentLook->setAddressee( mCurrentAddressee ); | 141 | mCurrentLook->setAddressee( mCurrentAddressee ); |
138 | 142 | ||
139 | } | 143 | } |
140 | } | 144 | } |
141 | 145 | ||
142 | KABC::Addressee ViewContainer::addressee() | 146 | KABC::Addressee ViewContainer::addressee() |
143 | { | 147 | { |
144 | static KABC::Addressee empty; // do not use! | 148 | static KABC::Addressee empty; // do not use! |
145 | 149 | ||
146 | if ( !mCurrentLook ) | 150 | if ( !mCurrentLook ) |
147 | return empty; | 151 | return empty; |
148 | else | 152 | else |
149 | return mCurrentLook->addressee(); | 153 | return mCurrentLook->addressee(); |
150 | } | 154 | } |
151 | 155 | ||
152 | void ViewContainer::setReadOnly( bool state ) | 156 | void ViewContainer::setReadOnly( bool state ) |
153 | { | 157 | { |
154 | if ( mCurrentLook ) | 158 | if ( mCurrentLook ) |
155 | mCurrentLook->setReadOnly( state ); | 159 | mCurrentLook->setReadOnly( state ); |
156 | } | 160 | } |
157 | 161 | ||
158 | #ifndef KAB_EMBEDDED | 162 | #ifndef KAB_EMBEDDED |
159 | #include "detailsviewcontainer.moc" | 163 | #include "detailsviewcontainer.moc" |
160 | #endif //KAB_EMBEDDED | 164 | #endif //KAB_EMBEDDED |
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 | |||
@@ -1,102 +1,103 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> | 3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@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 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 | ||
31 | class QComboBox; | 31 | class QComboBox; |
32 | class QWidgetStack; | 32 | class QWidgetStack; |
33 | 33 | ||
34 | class ViewContainer : public QWidget | 34 | class 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 | */ |
86 | void slotStyleSelected( int ); | 87 | void slotStyleSelected( int ); |
87 | 88 | ||
88 | /** | 89 | /** |
89 | Register the available looks. | 90 | Register the available looks. |
90 | */ | 91 | */ |
91 | void registerLooks(); | 92 | void registerLooks(); |
92 | 93 | ||
93 | private: | 94 | private: |
94 | KABC::Addressee mCurrentAddressee; | 95 | KABC::Addressee mCurrentAddressee; |
95 | KABBasicLook *mCurrentLook; | 96 | KABBasicLook *mCurrentLook; |
96 | QPtrList<KABLookFactory> mLookFactories; | 97 | QPtrList<KABLookFactory> mLookFactories; |
97 | 98 | ||
98 | QComboBox *mStyleCombo; | 99 | QComboBox *mStyleCombo; |
99 | QWidgetStack *mDetailsStack; | 100 | QWidgetStack *mDetailsStack; |
100 | }; | 101 | }; |
101 | 102 | ||
102 | #endif | 103 | #endif |
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 | |||
@@ -1,134 +1,136 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> | 3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@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_KABBASIC_H | 24 | #ifndef LOOK_KABBASIC_H |
25 | #define LOOK_KABBASIC_H | 25 | #define LOOK_KABBASIC_H |
26 | 26 | ||
27 | #include <kabc/addressbook.h> | 27 | #include <kabc/addressbook.h> |
28 | #include <qvbox.h> | 28 | #include <qvbox.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | This is a pure virtual base class that defines the | 33 | This is a pure virtual base class that defines the |
34 | interface for how to display and change entries of | 34 | interface for how to display and change entries of |
35 | the KDE addressbook. | 35 | the KDE addressbook. |
36 | 36 | ||
37 | This basic widget does not show anything in its client space. | 37 | This basic widget does not show anything in its client space. |
38 | Derive it and implement its look and how the user may edit the | 38 | Derive it and implement its look and how the user may edit the |
39 | entry. | 39 | entry. |
40 | 40 | ||
41 | The paintEvent() has to paint the whole widget, since repaint() | 41 | The paintEvent() has to paint the whole widget, since repaint() |
42 | calls will not delete the widgets background. | 42 | calls will not delete the widgets background. |
43 | */ | 43 | */ |
44 | class KABBasicLook : public QVBox | 44 | class KABBasicLook : public QVBox |
45 | { | 45 | { |
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; |
112 | bool mReadOnly; | 114 | bool mReadOnly; |
113 | }; | 115 | }; |
114 | 116 | ||
115 | class KABLookFactory | 117 | class KABLookFactory |
116 | { | 118 | { |
117 | public: | 119 | public: |
118 | KABLookFactory( QWidget *parent = 0, const char *name = 0 ); | 120 | KABLookFactory( QWidget *parent = 0, const char *name = 0 ); |
119 | virtual ~KABLookFactory(); | 121 | virtual ~KABLookFactory(); |
120 | 122 | ||
121 | virtual KABBasicLook *create() = 0; | 123 | virtual KABBasicLook *create() = 0; |
122 | 124 | ||
123 | /** | 125 | /** |
124 | Overload this method to provide a one-liner description | 126 | Overload this method to provide a one-liner description |
125 | for your look. | 127 | for your look. |
126 | */ | 128 | */ |
127 | virtual QString description() = 0; | 129 | virtual QString description() = 0; |
128 | 130 | ||
129 | protected: | 131 | protected: |
130 | QWidget *mParent; | 132 | QWidget *mParent; |
131 | const char* mName; | 133 | const char* mName; |
132 | }; | 134 | }; |
133 | 135 | ||
134 | #endif | 136 | #endif |
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> | ||
29 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) | 30 | KABHtmlView::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 | ||
36 | KABHtmlView::~KABHtmlView() | 39 | KABHtmlView::~KABHtmlView() |
37 | { | 40 | { |
38 | } | 41 | } |
42 | void KABHtmlView::printMe() | ||
43 | { | ||
44 | mView->printMe(); | ||
45 | |||
46 | } | ||
39 | 47 | ||
40 | void KABHtmlView::setAddressee( const KABC::Addressee &addr ) | 48 | void 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 | ||
31 | namespace KABC { class Addressee; } | 31 | namespace KABC { class Addressee; } |
32 | namespace KPIM { class AddresseeView; } | 32 | namespace KABC { class AddresseeView; } |
33 | 33 | ||
34 | class KABHtmlView : public KABBasicLook | 34 | class 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 | ||
58 | class KABHtmlViewFactory : public KABLookFactory | 60 | class 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 |