author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/details | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.cpp | 19 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.h | 8 | ||||
-rw-r--r-- | kaddressbook/details/look_basic.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/details/look_basic.h | 4 | ||||
-rw-r--r-- | kaddressbook/details/look_details.cpp | 12 | ||||
-rw-r--r-- | kaddressbook/details/look_details.h | 4 | ||||
-rw-r--r-- | kaddressbook/details/look_html.cpp | 6 |
7 files changed, 31 insertions, 28 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp index cee5886..4a86aca 100644 --- a/kaddressbook/details/detailsviewcontainer.cpp +++ b/kaddressbook/details/detailsviewcontainer.cpp | |||
@@ -1,164 +1,167 @@ | |||
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 <q3frame.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qwidgetstack.h> | 28 | #include <q3widgetstack.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3HBoxLayout> | ||
31 | #include <Q3VBoxLayout> | ||
29 | 32 | ||
30 | #include <kapplication.h> | 33 | #include <kapplication.h> |
31 | #include <kdebug.h> | 34 | #include <kdebug.h> |
32 | #include <kdialog.h> | 35 | #include <kdialog.h> |
33 | 36 | ||
34 | #include "look_basic.h" | 37 | #include "look_basic.h" |
35 | //#include "look_details.h" | 38 | //#include "look_details.h" |
36 | #include "look_html.h" | 39 | #include "look_html.h" |
37 | 40 | ||
38 | #ifdef KAB_EMBEDDED | 41 | #ifdef KAB_EMBEDDED |
39 | #include "kabprefs.h" | 42 | #include "kabprefs.h" |
40 | #endif //KAB_EMBEDDED | 43 | #endif //KAB_EMBEDDED |
41 | 44 | ||
42 | 45 | ||
43 | #include "detailsviewcontainer.h" | 46 | #include "detailsviewcontainer.h" |
44 | 47 | ||
45 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) | 48 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) |
46 | : QWidget( parent, name ), mCurrentLook( 0 ) | 49 | : QWidget( parent, name ), mCurrentLook( 0 ) |
47 | { | 50 | { |
48 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 51 | Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); |
49 | //topLayout->setMargin( KDialog::marginHint() ); | 52 | //topLayout->setMargin( KDialog::marginHint() ); |
50 | //topLayout->setSpacing( KDialog::spacingHint() ); | 53 | //topLayout->setSpacing( KDialog::spacingHint() ); |
51 | topLayout->setMargin( 0 ); | 54 | topLayout->setMargin( 0 ); |
52 | topLayout->setSpacing( 0 ); | 55 | topLayout->setSpacing( 0 ); |
53 | 56 | ||
54 | QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); | 57 | Q3BoxLayout *styleLayout = new Q3HBoxLayout( topLayout ); |
55 | 58 | ||
56 | QLabel *label = new QLabel( i18n("Style:"), this ); | 59 | QLabel *label = new QLabel( i18n("Style:"), this ); |
57 | styleLayout->addWidget( label ); | 60 | styleLayout->addWidget( label ); |
58 | 61 | ||
59 | mStyleCombo = new QComboBox( this ); | 62 | mStyleCombo = new QComboBox( this ); |
60 | styleLayout->addWidget( mStyleCombo ); | 63 | styleLayout->addWidget( mStyleCombo ); |
61 | 64 | ||
62 | QFrame *frameRuler = new QFrame( this ); | 65 | Q3Frame *frameRuler = new Q3Frame( this ); |
63 | //US frameRuler->setFrameShape( QFrame::HLine ); | 66 | //US frameRuler->setFrameShape( QFrame::HLine ); |
64 | //US frameRuler->setFrameShadow( QFrame::Sunken ); | 67 | //US frameRuler->setFrameShadow( QFrame::Sunken ); |
65 | //US topLayout->addWidget( frameRuler ); | 68 | //US topLayout->addWidget( frameRuler ); |
66 | 69 | ||
67 | mDetailsStack = new QWidgetStack( this ); | 70 | mDetailsStack = new Q3WidgetStack( this ); |
68 | topLayout->addWidget( mDetailsStack, 1 ); | 71 | topLayout->addWidget( mDetailsStack, 1 ); |
69 | 72 | ||
70 | registerLooks(); | 73 | registerLooks(); |
71 | 74 | ||
72 | #if 1 | 75 | #if 1 |
73 | // Hide detailed view selection combo box, because we currently have | 76 | // Hide detailed view selection combo box, because we currently have |
74 | // only one. Reenable it when there are more detailed views. | 77 | // only one. Reenable it when there are more detailed views. |
75 | label->hide(); | 78 | label->hide(); |
76 | mStyleCombo->hide(); | 79 | mStyleCombo->hide(); |
77 | frameRuler->hide(); | 80 | frameRuler->hide(); |
78 | #endif | 81 | #endif |
79 | } | 82 | } |
80 | 83 | ||
81 | void ViewContainer::printView() | 84 | void ViewContainer::printView() |
82 | { | 85 | { |
83 | mCurrentLook->printView(); | 86 | mCurrentLook->printView(); |
84 | } | 87 | } |
85 | KABBasicLook *ViewContainer::currentLook() | 88 | KABBasicLook *ViewContainer::currentLook() |
86 | { | 89 | { |
87 | return mCurrentLook; | 90 | return mCurrentLook; |
88 | } | 91 | } |
89 | 92 | ||
90 | void ViewContainer::registerLooks() | 93 | void ViewContainer::registerLooks() |
91 | { | 94 | { |
92 | mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); | 95 | mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); |
93 | // mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); | 96 | // mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); |
94 | mStyleCombo->clear(); | 97 | mStyleCombo->clear(); |
95 | 98 | ||
96 | for ( uint i = 0; i < mLookFactories.count(); ++i ) | 99 | for ( uint i = 0; i < mLookFactories.count(); ++i ) |
97 | mStyleCombo->insertItem( mLookFactories.at( i )->description() ); | 100 | mStyleCombo->insertItem( mLookFactories.at( i )->description() ); |
98 | 101 | ||
99 | if ( !mLookFactories.isEmpty() ) | 102 | if ( !mLookFactories.isEmpty() ) |
100 | slotStyleSelected( 0 ); | 103 | slotStyleSelected( 0 ); |
101 | } | 104 | } |
102 | 105 | ||
103 | void ViewContainer::slotStyleSelected( int index ) | 106 | void ViewContainer::slotStyleSelected( int index ) |
104 | { | 107 | { |
105 | #ifndef KAB_EMBEDDED | 108 | #ifndef KAB_EMBEDDED |
106 | KConfig *config = kapp->config(); | 109 | KConfig *config = kapp->config(); |
107 | #else //KAB_EMBEDDED | 110 | #else //KAB_EMBEDDED |
108 | //US I hope I got the same config object as above expected. | 111 | //US I hope I got the same config object as above expected. |
109 | KConfig *config = KABPrefs::instance()->getConfig(); | 112 | KConfig *config = KABPrefs::instance()->getConfig(); |
110 | #endif //KAB_EMBEDDED | 113 | #endif //KAB_EMBEDDED |
111 | KABC::Addressee addr; | 114 | KABC::Addressee addr; |
112 | 115 | ||
113 | if ( index >= 0 && index < mStyleCombo->count() ) { | 116 | if ( index >= 0 && index < mStyleCombo->count() ) { |
114 | if ( mCurrentLook != 0 ) { | 117 | if ( mCurrentLook != 0 ) { |
115 | mCurrentLook->saveSettings( config ); | 118 | mCurrentLook->saveSettings( config ); |
116 | addr = mCurrentLook->addressee(); | 119 | addr = mCurrentLook->addressee(); |
117 | 120 | ||
118 | delete mCurrentLook; | 121 | delete mCurrentLook; |
119 | mCurrentLook = 0; | 122 | mCurrentLook = 0; |
120 | } | 123 | } |
121 | 124 | ||
122 | KABLookFactory *factory = mLookFactories.at( index ); | 125 | KABLookFactory *factory = mLookFactories.at( index ); |
123 | 126 | ||
124 | mCurrentLook = factory->create(); | 127 | mCurrentLook = factory->create(); |
125 | mDetailsStack->raiseWidget( mCurrentLook ); | 128 | mDetailsStack->raiseWidget( mCurrentLook ); |
126 | 129 | ||
127 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, | 130 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, |
128 | SIGNAL( sendEmail( const QString& ) ) ); | 131 | SIGNAL( sendEmail( const QString& ) ) ); |
129 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, | 132 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, |
130 | SIGNAL( browse( const QString& ) ) ); | 133 | SIGNAL( browse( const QString& ) ) ); |
131 | } | 134 | } |
132 | 135 | ||
133 | mCurrentLook->restoreSettings( config ); | 136 | mCurrentLook->restoreSettings( config ); |
134 | mCurrentLook->setAddressee( addr ); | 137 | mCurrentLook->setAddressee( addr ); |
135 | } | 138 | } |
136 | 139 | ||
137 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) | 140 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) |
138 | { | 141 | { |
139 | if ( mCurrentLook != 0 ) { | 142 | if ( mCurrentLook != 0 ) { |
140 | mCurrentAddressee = addressee; | 143 | mCurrentAddressee = addressee; |
141 | mCurrentLook->setAddressee( mCurrentAddressee ); | 144 | mCurrentLook->setAddressee( mCurrentAddressee ); |
142 | 145 | ||
143 | } | 146 | } |
144 | } | 147 | } |
145 | 148 | ||
146 | KABC::Addressee ViewContainer::addressee() | 149 | KABC::Addressee ViewContainer::addressee() |
147 | { | 150 | { |
148 | static KABC::Addressee empty; // do not use! | 151 | static KABC::Addressee empty; // do not use! |
149 | 152 | ||
150 | if ( !mCurrentLook ) | 153 | if ( !mCurrentLook ) |
151 | return empty; | 154 | return empty; |
152 | else | 155 | else |
153 | return mCurrentLook->addressee(); | 156 | return mCurrentLook->addressee(); |
154 | } | 157 | } |
155 | 158 | ||
156 | void ViewContainer::setReadOnly( bool state ) | 159 | void ViewContainer::setReadOnly( bool state ) |
157 | { | 160 | { |
158 | if ( mCurrentLook ) | 161 | if ( mCurrentLook ) |
159 | mCurrentLook->setReadOnly( state ); | 162 | mCurrentLook->setReadOnly( state ); |
160 | } | 163 | } |
161 | 164 | ||
162 | #ifndef KAB_EMBEDDED | 165 | #ifndef KAB_EMBEDDED_ |
163 | #include "detailsviewcontainer.moc" | 166 | #include "moc_detailsviewcontainer.cpp" |
164 | #endif //KAB_EMBEDDED | 167 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h index 9684736..f310a30 100644 --- a/kaddressbook/details/detailsviewcontainer.h +++ b/kaddressbook/details/detailsviewcontainer.h | |||
@@ -1,103 +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 <q3ptrlist.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 Q3WidgetStack; |
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 | void printView(); |
55 | /** | 55 | /** |
56 | Set the contact currently displayed. | 56 | Set the contact currently displayed. |
57 | */ | 57 | */ |
58 | void setAddressee( const KABC::Addressee& addressee ); | 58 | void setAddressee( const KABC::Addressee& addressee ); |
59 | 59 | ||
60 | /** | 60 | /** |
61 | Set read-write state. | 61 | Set read-write state. |
62 | */ | 62 | */ |
63 | void setReadOnly( bool state ); | 63 | void setReadOnly( bool state ); |
64 | 64 | ||
65 | signals: | 65 | signals: |
66 | /** | 66 | /** |
67 | The contact has been changed. | 67 | The contact has been changed. |
68 | */ | 68 | */ |
69 | void addresseeChanged(); | 69 | void addresseeChanged(); |
70 | 70 | ||
71 | /** | 71 | /** |
72 | The user acticated the email address displayed. This may happen | 72 | The user acticated the email address displayed. This may happen |
73 | by, for example, clicking on the displayed mailto-URL. | 73 | by, for example, clicking on the displayed mailto-URL. |
74 | */ | 74 | */ |
75 | void sendEmail( const QString& ); | 75 | void sendEmail( const QString& ); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | The user activated one of the displayed HTTP URLs. For example | 78 | The user activated one of the displayed HTTP URLs. For example |
79 | by clicking on the displayed homepage address. | 79 | by clicking on the displayed homepage address. |
80 | */ | 80 | */ |
81 | void browse( const QString& ); | 81 | void browse( const QString& ); |
82 | 82 | ||
83 | protected: | 83 | protected: |
84 | /** | 84 | /** |
85 | A style has been selected. Overloaded from base class. | 85 | A style has been selected. Overloaded from base class. |
86 | */ | 86 | */ |
87 | void slotStyleSelected( int ); | 87 | void slotStyleSelected( int ); |
88 | 88 | ||
89 | /** | 89 | /** |
90 | Register the available looks. | 90 | Register the available looks. |
91 | */ | 91 | */ |
92 | void registerLooks(); | 92 | void registerLooks(); |
93 | 93 | ||
94 | private: | 94 | private: |
95 | KABC::Addressee mCurrentAddressee; | 95 | KABC::Addressee mCurrentAddressee; |
96 | KABBasicLook *mCurrentLook; | 96 | KABBasicLook *mCurrentLook; |
97 | QPtrList<KABLookFactory> mLookFactories; | 97 | Q3PtrList<KABLookFactory> mLookFactories; |
98 | 98 | ||
99 | QComboBox *mStyleCombo; | 99 | QComboBox *mStyleCombo; |
100 | QWidgetStack *mDetailsStack; | 100 | Q3WidgetStack *mDetailsStack; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | #endif | 103 | #endif |
diff --git a/kaddressbook/details/look_basic.cpp b/kaddressbook/details/look_basic.cpp index 0245686..48cc42a 100644 --- a/kaddressbook/details/look_basic.cpp +++ b/kaddressbook/details/look_basic.cpp | |||
@@ -1,75 +1,75 @@ | |||
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 <kdebug.h> | 24 | #include <kdebug.h> |
25 | 25 | ||
26 | #include "look_basic.h" | 26 | #include "look_basic.h" |
27 | 27 | ||
28 | KABBasicLook::KABBasicLook( QWidget *parent, const char *name ) | 28 | KABBasicLook::KABBasicLook( QWidget *parent, const char *name ) |
29 | : QVBox( parent, name ), mReadOnly( false ) | 29 | : Q3VBox( parent, name ), mReadOnly( false ) |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | void KABBasicLook::setReadOnly( bool state ) | 33 | void KABBasicLook::setReadOnly( bool state ) |
34 | { | 34 | { |
35 | mReadOnly = state; | 35 | mReadOnly = state; |
36 | } | 36 | } |
37 | 37 | ||
38 | bool KABBasicLook::isReadOnly() const | 38 | bool KABBasicLook::isReadOnly() const |
39 | { | 39 | { |
40 | return mReadOnly; | 40 | return mReadOnly; |
41 | } | 41 | } |
42 | 42 | ||
43 | void KABBasicLook::setAddressee( const KABC::Addressee &addr ) | 43 | void KABBasicLook::setAddressee( const KABC::Addressee &addr ) |
44 | { | 44 | { |
45 | if ( mAddressee == addr ) | 45 | if ( mAddressee == addr ) |
46 | return; | 46 | return; |
47 | 47 | ||
48 | mAddressee = addr; | 48 | mAddressee = addr; |
49 | repaint( false ); | 49 | repaint( false ); |
50 | } | 50 | } |
51 | 51 | ||
52 | KABC::Addressee KABBasicLook::addressee() | 52 | KABC::Addressee KABBasicLook::addressee() |
53 | { | 53 | { |
54 | return mAddressee; | 54 | return mAddressee; |
55 | } | 55 | } |
56 | 56 | ||
57 | void KABBasicLook::restoreSettings( KConfig* ) | 57 | void KABBasicLook::restoreSettings( KConfig* ) |
58 | { | 58 | { |
59 | } | 59 | } |
60 | 60 | ||
61 | void KABBasicLook::saveSettings( KConfig* ) | 61 | void KABBasicLook::saveSettings( KConfig* ) |
62 | { | 62 | { |
63 | } | 63 | } |
64 | 64 | ||
65 | KABLookFactory::KABLookFactory( QWidget *parent, const char *name ) | 65 | KABLookFactory::KABLookFactory( QWidget *parent, const char *name ) |
66 | : mParent( parent ), mName( name ) | 66 | : mParent( parent ), mName( name ) |
67 | { | 67 | { |
68 | } | 68 | } |
69 | 69 | ||
70 | KABLookFactory::~KABLookFactory() | 70 | KABLookFactory::~KABLookFactory() |
71 | { | 71 | { |
72 | } | 72 | } |
73 | #ifndef KAB_EMBEDDED | 73 | #ifndef KAB_EMBEDDED_ |
74 | #include "look_basic.moc" | 74 | #include "moc_look_basic.cpp" |
75 | #endif //KAB_EMBEDDED | 75 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/look_basic.h b/kaddressbook/details/look_basic.h index a65c99c..a70e7f7 100644 --- a/kaddressbook/details/look_basic.h +++ b/kaddressbook/details/look_basic.h | |||
@@ -1,136 +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 <q3vbox.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 Q3VBox |
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 | void printView(){ emit printMyView();} |
79 | 79 | ||
80 | signals: | 80 | signals: |
81 | void printMyView(); | 81 | void printMyView(); |
82 | /** | 82 | /** |
83 | This signal is emitted when the user changed the entry. | 83 | This signal is emitted when the user changed the entry. |
84 | */ | 84 | */ |
85 | void entryChanged(); | 85 | void entryChanged(); |
86 | 86 | ||
87 | /** | 87 | /** |
88 | This signal indicates that the entry needs to be changed | 88 | This signal indicates that the entry needs to be changed |
89 | immidiately in the database. This might be due to changes in | 89 | immidiately in the database. This might be due to changes in |
90 | values that are available in menus. | 90 | values that are available in menus. |
91 | */ | 91 | */ |
92 | void saveMe(); | 92 | void saveMe(); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | The user acticated the email address displayed. This may happen | 95 | The user acticated the email address displayed. This may happen |
96 | by, for example, clicking on the displayed mailto-URL. | 96 | by, for example, clicking on the displayed mailto-URL. |
97 | */ | 97 | */ |
98 | void sendEmail( const QString &email ); | 98 | void sendEmail( const QString &email ); |
99 | 99 | ||
100 | /** | 100 | /** |
101 | The user activated one of the displayed HTTP URLs. For example | 101 | The user activated one of the displayed HTTP URLs. For example |
102 | by clicking on the displayed homepage address. | 102 | by clicking on the displayed homepage address. |
103 | */ | 103 | */ |
104 | void browse( const QString &url ); | 104 | void browse( const QString &url ); |
105 | 105 | ||
106 | public slots: | 106 | public slots: |
107 | /** | 107 | /** |
108 | Set read-write state. | 108 | Set read-write state. |
109 | */ | 109 | */ |
110 | virtual void setReadOnly( bool state ); | 110 | virtual void setReadOnly( bool state ); |
111 | 111 | ||
112 | private: | 112 | private: |
113 | KABC::Addressee mAddressee; | 113 | KABC::Addressee mAddressee; |
114 | bool mReadOnly; | 114 | bool mReadOnly; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | class KABLookFactory | 117 | class KABLookFactory |
118 | { | 118 | { |
119 | public: | 119 | public: |
120 | KABLookFactory( QWidget *parent = 0, const char *name = 0 ); | 120 | KABLookFactory( QWidget *parent = 0, const char *name = 0 ); |
121 | virtual ~KABLookFactory(); | 121 | virtual ~KABLookFactory(); |
122 | 122 | ||
123 | virtual KABBasicLook *create() = 0; | 123 | virtual KABBasicLook *create() = 0; |
124 | 124 | ||
125 | /** | 125 | /** |
126 | Overload this method to provide a one-liner description | 126 | Overload this method to provide a one-liner description |
127 | for your look. | 127 | for your look. |
128 | */ | 128 | */ |
129 | virtual QString description() = 0; | 129 | virtual QString description() = 0; |
130 | 130 | ||
131 | protected: | 131 | protected: |
132 | QWidget *mParent; | 132 | QWidget *mParent; |
133 | const char* mName; | 133 | const char* mName; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | #endif | 136 | #endif |
diff --git a/kaddressbook/details/look_details.cpp b/kaddressbook/details/look_details.cpp index 11d06e9..2c3a79d 100644 --- a/kaddressbook/details/look_details.cpp +++ b/kaddressbook/details/look_details.cpp | |||
@@ -1,419 +1,419 @@ | |||
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 <kconfig.h> | 24 | #include <kconfig.h> |
25 | #include <kdebug.h> | 25 | #include <kdebug.h> |
26 | #include <kglobalsettings.h> | 26 | #include <kglobalsettings.h> |
27 | #include <kinstance.h> | 27 | #include <kinstance.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | #include <kstandarddirs.h> | 29 | #include <kstandarddirs.h> |
30 | 30 | ||
31 | #include <qcursor.h> | 31 | #include <qcursor.h> |
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qpainter.h> | 33 | #include <qpainter.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | 35 | ||
36 | #include "global.h" | 36 | #include "global.h" |
37 | #include "kabentrypainter.h" | 37 | #include "kabentrypainter.h" |
38 | 38 | ||
39 | #include "look_details.h" | 39 | #include "look_details.h" |
40 | 40 | ||
41 | #define GRID 5 | 41 | #define GRID 5 |
42 | 42 | ||
43 | const QString KABDetailedView::mBorderedBGDir = "kab3part/backgrounds/bordered/"; | 43 | const QString KABDetailedView::mBorderedBGDir = "kab3part/backgrounds/bordered/"; |
44 | const QString KABDetailedView::mTiledBGDir = "kab3part/backgrounds/tiled/"; | 44 | const QString KABDetailedView::mTiledBGDir = "kab3part/backgrounds/tiled/"; |
45 | 45 | ||
46 | KABDetailedView::KABDetailedView( QWidget *parent, const char *name ) | 46 | KABDetailedView::KABDetailedView( QWidget *parent, const char *name ) |
47 | : KABBasicLook( parent, name ), mPainter( 0 ), mBackgroundStyle( None ), | 47 | : KABBasicLook( parent, name ), mPainter( 0 ), mBackgroundStyle( None ), |
48 | mDefaultBGColor( white ), mHeadLineBGColor( darkBlue ), | 48 | mDefaultBGColor( white ), mHeadLineBGColor( darkBlue ), |
49 | mHeadLineTextColor( yellow ), mGrid( 3 ), mMenuBorderedBG( 0 ), | 49 | mHeadLineTextColor( yellow ), mGrid( 3 ), mMenuBorderedBG( 0 ), |
50 | mMenuTiledBG( 0 ) | 50 | mMenuTiledBG( 0 ) |
51 | { | 51 | { |
52 | KToggleAction** actions[] = { | 52 | KToggleAction** actions[] = { |
53 | &mActionShowAddresses, | 53 | &mActionShowAddresses, |
54 | &mActionShowEmails, | 54 | &mActionShowEmails, |
55 | &mActionShowPhones, | 55 | &mActionShowPhones, |
56 | &mActionShowURLs | 56 | &mActionShowURLs |
57 | }; | 57 | }; |
58 | 58 | ||
59 | QString actionTexts[] = { | 59 | QString actionTexts[] = { |
60 | i18n( "Show Postal Addresses" ), | 60 | i18n( "Show Postal Addresses" ), |
61 | i18n( "Show Email Addresses" ), | 61 | i18n( "Show Email Addresses" ), |
62 | i18n( "Show Telephone Numbers" ), | 62 | i18n( "Show Telephone Numbers" ), |
63 | i18n( "Show Web Pages (URLs)" ) | 63 | i18n( "Show Web Pages (URLs)" ) |
64 | }; | 64 | }; |
65 | 65 | ||
66 | QFont general = KGlobalSettings::generalMaxFont(); | 66 | QFont general = KGlobalSettings::generalMaxFont(); |
67 | QFont fixed = KGlobalSettings::fixedFont(); | 67 | QFont fixed = KGlobalSettings::fixedFont(); |
68 | QString gfont = general.family(); | 68 | QString gfont = general.family(); |
69 | QString ffont = fixed.family(); | 69 | QString ffont = fixed.family(); |
70 | 70 | ||
71 | int gpointsize = general.pixelSize(); | 71 | int gpointsize = general.pixelSize(); |
72 | if ( gpointsize == -1 ) | 72 | if ( gpointsize == -1 ) |
73 | gpointsize = general.pointSize(); | 73 | gpointsize = general.pointSize(); |
74 | 74 | ||
75 | int fpointsize = fixed.pixelSize(); | 75 | int fpointsize = fixed.pixelSize(); |
76 | if ( fpointsize == -1 ) | 76 | if ( fpointsize == -1 ) |
77 | fpointsize = fixed.pointSize(); | 77 | fpointsize = fixed.pointSize(); |
78 | 78 | ||
79 | mPainter = new KABEntryPainter; | 79 | mPainter = new KABEntryPainter; |
80 | 80 | ||
81 | mPainter->setForegroundColor( black ); | 81 | mPainter->setForegroundColor( black ); |
82 | mPainter->setHeaderColor( mHeadLineTextColor ); | 82 | mPainter->setHeaderColor( mHeadLineTextColor ); |
83 | mPainter->setUseHeaderColor( mUseHeadLineBGColor ); | 83 | mPainter->setUseHeaderColor( mUseHeadLineBGColor ); |
84 | mPainter->setBackgroundColor( mHeadLineBGColor ); | 84 | mPainter->setBackgroundColor( mHeadLineBGColor ); |
85 | 85 | ||
86 | mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) ); | 86 | mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) ); |
87 | mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) ); | 87 | mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) ); |
88 | mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); | 88 | mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); |
89 | mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) ); | 89 | mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) ); |
90 | mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); | 90 | mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); |
91 | 91 | ||
92 | const int numActions = sizeof( actions ) / sizeof( actions[ 0 ] ); | 92 | const int numActions = sizeof( actions ) / sizeof( actions[ 0 ] ); |
93 | 93 | ||
94 | for ( int count = 0; count < numActions; ++count ) { | 94 | for ( int count = 0; count < numActions; ++count ) { |
95 | *actions[ count ] = new KToggleAction( actionTexts[ count ] ); | 95 | *actions[ count ] = new KToggleAction( actionTexts[ count ] ); |
96 | (*actions[ count ])->setChecked( true ); | 96 | (*actions[ count ])->setChecked( true ); |
97 | } | 97 | } |
98 | 98 | ||
99 | setMouseTracking( true ); | 99 | setMouseTracking( true ); |
100 | 100 | ||
101 | setBackgroundMode( NoBackground ); | 101 | setBackgroundMode( NoBackground ); |
102 | } | 102 | } |
103 | 103 | ||
104 | KABDetailedView::~KABDetailedView() | 104 | KABDetailedView::~KABDetailedView() |
105 | { | 105 | { |
106 | delete mPainter; | 106 | delete mPainter; |
107 | mPainter = 0; | 107 | mPainter = 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | bool KABDetailedView::getBackground( QString path, QPixmap& image ) | 110 | bool KABDetailedView::getBackground( QString path, QPixmap& image ) |
111 | { | 111 | { |
112 | QMap<QString, QPixmap>::iterator pos; | 112 | QMap<QString, QPixmap>::iterator pos; |
113 | 113 | ||
114 | pos = mBackgroundMap.find( path ); | 114 | pos = mBackgroundMap.find( path ); |
115 | if ( pos == mBackgroundMap.end() ) { // the image has not been loaded previously | 115 | if ( pos == mBackgroundMap.end() ) { // the image has not been loaded previously |
116 | if ( image.load( path ) ) { | 116 | if ( image.load( path ) ) { |
117 | mBackgroundMap[ path ] = image; | 117 | mBackgroundMap[ path ] = image; |
118 | return true; | 118 | return true; |
119 | } else | 119 | } else |
120 | return false; | 120 | return false; |
121 | } else { // image found in cache | 121 | } else { // image found in cache |
122 | image = pos.data(); | 122 | image = pos.data(); |
123 | return true; | 123 | return true; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | void KABDetailedView::paintEvent( QPaintEvent* ) | 127 | void KABDetailedView::paintEvent( QPaintEvent* ) |
128 | { | 128 | { |
129 | const int BorderSpace = mGrid; | 129 | const int BorderSpace = mGrid; |
130 | QPixmap pm( width(), height() ); | 130 | QPixmap pm( width(), height() ); |
131 | QPainter p; | 131 | QPainter p; |
132 | 132 | ||
133 | QRect entryArea = QRect( BorderSpace, mGrid, width() - mGrid - BorderSpace, | 133 | QRect entryArea = QRect( BorderSpace, mGrid, width() - mGrid - BorderSpace, |
134 | height() - 2 * mGrid ); | 134 | height() - 2 * mGrid ); |
135 | p.begin( &pm ); | 135 | p.begin( &pm ); |
136 | 136 | ||
137 | p.setPen( darkBlue ); | 137 | p.setPen( darkBlue ); |
138 | p.setBrush( mDefaultBGColor ); | 138 | p.setBrush( mDefaultBGColor ); |
139 | p.drawRect( 0, 0, width(), height() ); | 139 | p.drawRect( 0, 0, width(), height() ); |
140 | switch ( mBackgroundStyle ) { | 140 | switch ( mBackgroundStyle ) { |
141 | case Tiled: | 141 | case Tiled: |
142 | p.drawTiledPixmap( 1, 1, width() - 2, height() - 2, mCurrentBackground ); | 142 | p.drawTiledPixmap( 1, 1, width() - 2, height() - 2, mCurrentBackground ); |
143 | break; | 143 | break; |
144 | case Bordered: | 144 | case Bordered: |
145 | p.drawTiledPixmap( 1, 1, QMIN( width() - 2, mCurrentBackground.width() ), | 145 | p.drawTiledPixmap( 1, 1, QMIN( width() - 2, mCurrentBackground.width() ), |
146 | height() - 2, mCurrentBackground ); | 146 | height() - 2, mCurrentBackground ); |
147 | break; | 147 | break; |
148 | case None: // no BG image defined for this entry: | 148 | case None: // no BG image defined for this entry: |
149 | default: | 149 | default: |
150 | if ( mUseDefaultBGImage ) | 150 | if ( mUseDefaultBGImage ) |
151 | p.drawTiledPixmap( 1, 1, width() - 2, height() - 2, mDefaultBGImage ); | 151 | p.drawTiledPixmap( 1, 1, width() - 2, height() - 2, mDefaultBGImage ); |
152 | break; | 152 | break; |
153 | }; | 153 | }; |
154 | 154 | ||
155 | p.setViewport( entryArea ); | 155 | p.setViewport( entryArea ); |
156 | 156 | ||
157 | mPainter->setShowAddresses( mActionShowAddresses->isChecked() ); | 157 | mPainter->setShowAddresses( mActionShowAddresses->isChecked() ); |
158 | mPainter->setShowEmails( mActionShowEmails->isChecked() ); | 158 | mPainter->setShowEmails( mActionShowEmails->isChecked() ); |
159 | mPainter->setShowPhones( mActionShowPhones->isChecked() ); | 159 | mPainter->setShowPhones( mActionShowPhones->isChecked() ); |
160 | mPainter->setShowURLs( mActionShowURLs->isChecked() ); | 160 | mPainter->setShowURLs( mActionShowURLs->isChecked() ); |
161 | mPainter->printAddressee( addressee(), QRect( 0, 0, entryArea.width(), | 161 | mPainter->printAddressee( addressee(), QRect( 0, 0, entryArea.width(), |
162 | entryArea.height() ), &p ); | 162 | entryArea.height() ), &p ); |
163 | p.end(); | 163 | p.end(); |
164 | bitBlt( this, 0, 0, &pm ); | 164 | bitBlt( this, 0, 0, &pm ); |
165 | } | 165 | } |
166 | 166 | ||
167 | void KABDetailedView::mouseMoveEvent( QMouseEvent *e ) | 167 | void KABDetailedView::mouseMoveEvent( QMouseEvent *e ) |
168 | { | 168 | { |
169 | QPoint bias( mGrid, mGrid ); | 169 | QPoint bias( mGrid, mGrid ); |
170 | int rc; | 170 | int rc; |
171 | bool hit = false; | 171 | bool hit = false; |
172 | 172 | ||
173 | if ( ( rc = mPainter->hitsEmail( e->pos() - bias ) ) != -1 ) | 173 | if ( ( rc = mPainter->hitsEmail( e->pos() - bias ) ) != -1 ) |
174 | hit = true; | 174 | hit = true; |
175 | else if ( ( rc = mPainter->hitsURL( e->pos() - bias ) ) != -1 ) | 175 | else if ( ( rc = mPainter->hitsURL( e->pos() - bias ) ) != -1 ) |
176 | hit = true; | 176 | hit = true; |
177 | else if ( ( rc = mPainter->hitsPhone( e->pos() - bias ) ) != -1 ) | 177 | else if ( ( rc = mPainter->hitsPhone( e->pos() - bias ) ) != -1 ) |
178 | hit = true; | 178 | hit = true; |
179 | else if ( ( rc = mPainter->hitsTalk( e->pos() - bias ) ) != -1 ) | 179 | else if ( ( rc = mPainter->hitsTalk( e->pos() - bias ) ) != -1 ) |
180 | hit = true; | 180 | hit = true; |
181 | 181 | ||
182 | if ( hit ) { | 182 | if ( hit ) { |
183 | if ( cursor().shape() != PointingHandCursor ) | 183 | if ( cursor().shape() != PointingHandCursor ) |
184 | setCursor( PointingHandCursor ); | 184 | setCursor( PointingHandCursor ); |
185 | else if( cursor().shape() != ArrowCursor ) | 185 | else if( cursor().shape() != ArrowCursor ) |
186 | setCursor(ArrowCursor); | 186 | setCursor(ArrowCursor); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | void KABDetailedView::mousePressEvent( QMouseEvent *e ) | 190 | void KABDetailedView::mousePressEvent( QMouseEvent *e ) |
191 | { | 191 | { |
192 | QPopupMenu menu( this ); | 192 | Q3PopupMenu menu( this ); |
193 | QPopupMenu *menuBG = new QPopupMenu( &menu ); | 193 | Q3PopupMenu *menuBG = new Q3PopupMenu( &menu ); |
194 | mMenuBorderedBG = new QPopupMenu( &menu ); | 194 | mMenuBorderedBG = new Q3PopupMenu( &menu ); |
195 | mMenuTiledBG = new QPopupMenu( &menu ); | 195 | mMenuTiledBG = new Q3PopupMenu( &menu ); |
196 | 196 | ||
197 | menu.insertItem( i18n( "Select Background" ), menuBG ); | 197 | menu.insertItem( i18n( "Select Background" ), menuBG ); |
198 | menuBG->insertItem( i18n( "Bordered Backgrounds" ), mMenuBorderedBG ); | 198 | menuBG->insertItem( i18n( "Bordered Backgrounds" ), mMenuBorderedBG ); |
199 | menuBG->insertItem( i18n( "Tiled Backgrounds" ), mMenuTiledBG ); | 199 | menuBG->insertItem( i18n( "Tiled Backgrounds" ), mMenuTiledBG ); |
200 | menu.insertSeparator(); | 200 | menu.insertSeparator(); |
201 | 201 | ||
202 | QPoint point = e->pos() - QPoint( mGrid, mGrid ); | 202 | QPoint point = e->pos() - QPoint( mGrid, mGrid ); |
203 | int rc; | 203 | int rc; |
204 | QStringList dirsBorderedBG, dirsTiledBG; | 204 | QStringList dirsBorderedBG, dirsTiledBG; |
205 | QDir dir; | 205 | QDir dir; |
206 | 206 | ||
207 | switch( e->button() ) { | 207 | switch( e->button() ) { |
208 | case QMouseEvent::RightButton: | 208 | case QMouseEvent::RightButton: |
209 | if ( isReadOnly() ) | 209 | if ( isReadOnly() ) |
210 | menu.setItemEnabled( menu.idAt( 0 ), false ); | 210 | menu.setItemEnabled( menu.idAt( 0 ), false ); |
211 | else { | 211 | else { |
212 | // TODO: settings need to be saved in view options | 212 | // TODO: settings need to be saved in view options |
213 | dirsBorderedBG = KGlobal::instance()->dirs()->findDirs( "data", mBorderedBGDir ); | 213 | dirsBorderedBG = KGlobal::instance()->dirs()->findDirs( "data", mBorderedBGDir ); |
214 | if ( dirsBorderedBG.count() > 0 ) { | 214 | if ( dirsBorderedBG.count() > 0 ) { |
215 | dir.setPath( dirsBorderedBG[ 0 ] ); | 215 | dir.setPath( dirsBorderedBG[ 0 ] ); |
216 | mBorders = dir.entryList( QDir::Files ); | 216 | mBorders = dir.entryList( QDir::Files ); |
217 | for ( uint count = 0; count < mBorders.count(); ++count ) | 217 | for ( uint count = 0; count < mBorders.count(); ++count ) |
218 | mMenuBorderedBG->insertItem( mBorders[ count ], count ); | 218 | mMenuBorderedBG->insertItem( mBorders[ count ], count ); |
219 | 219 | ||
220 | connect( mMenuBorderedBG, SIGNAL( activated( int ) ), | 220 | connect( mMenuBorderedBG, SIGNAL( activated( int ) ), |
221 | SLOT( slotBorderedBGSelected( int ) ) ); | 221 | SLOT( slotBorderedBGSelected( int ) ) ); |
222 | } else | 222 | } else |
223 | menuBG->setItemEnabled( menuBG->idAt( 0 ), false ); | 223 | menuBG->setItemEnabled( menuBG->idAt( 0 ), false ); |
224 | 224 | ||
225 | dirsTiledBG = KGlobal::instance()->dirs()->findDirs( "data", mTiledBGDir ); | 225 | dirsTiledBG = KGlobal::instance()->dirs()->findDirs( "data", mTiledBGDir ); |
226 | if ( dirsTiledBG.count() > 0 ) { | 226 | if ( dirsTiledBG.count() > 0 ) { |
227 | dir.setPath( dirsTiledBG[ 0 ] ); | 227 | dir.setPath( dirsTiledBG[ 0 ] ); |
228 | mTiles = dir.entryList( QDir::Files ); | 228 | mTiles = dir.entryList( QDir::Files ); |
229 | for ( uint count = 0; count < mTiles.count(); ++count ) | 229 | for ( uint count = 0; count < mTiles.count(); ++count ) |
230 | mMenuTiledBG->insertItem( mTiles[ count ], count ); | 230 | mMenuTiledBG->insertItem( mTiles[ count ], count ); |
231 | 231 | ||
232 | connect( mMenuTiledBG, SIGNAL( activated( int ) ), | 232 | connect( mMenuTiledBG, SIGNAL( activated( int ) ), |
233 | SLOT( slotTiledBGSelected( int ) ) ); | 233 | SLOT( slotTiledBGSelected( int ) ) ); |
234 | } else | 234 | } else |
235 | menuBG->setItemEnabled( menuBG->idAt( 1 ), false ); | 235 | menuBG->setItemEnabled( menuBG->idAt( 1 ), false ); |
236 | } | 236 | } |
237 | 237 | ||
238 | mActionShowAddresses->plug( &menu ); | 238 | mActionShowAddresses->plug( &menu ); |
239 | mActionShowEmails->plug( &menu ); | 239 | mActionShowEmails->plug( &menu ); |
240 | mActionShowPhones->plug( &menu ); | 240 | mActionShowPhones->plug( &menu ); |
241 | mActionShowURLs->plug( &menu ); | 241 | mActionShowURLs->plug( &menu ); |
242 | 242 | ||
243 | menu.exec( e->globalPos() ); | 243 | menu.exec( e->globalPos() ); |
244 | break; | 244 | break; |
245 | 245 | ||
246 | case QMouseEvent::LeftButton: | 246 | case QMouseEvent::LeftButton: |
247 | // find whether the pointer touches an email address, URL, | 247 | // find whether the pointer touches an email address, URL, |
248 | // talk address or telephone number: | 248 | // talk address or telephone number: |
249 | if ( ( rc = mPainter->hitsEmail( point ) ) != -1 ) { | 249 | if ( ( rc = mPainter->hitsEmail( point ) ) != -1 ) { |
250 | emit sendEmail( addressee().emails()[ rc ] ); | 250 | emit sendEmail( addressee().emails()[ rc ] ); |
251 | break; | 251 | break; |
252 | } | 252 | } |
253 | if ( ( rc = mPainter->hitsURL( point ) ) != -1 ) { | 253 | if ( ( rc = mPainter->hitsURL( point ) ) != -1 ) { |
254 | emit browse( addressee().url().prettyURL() ); | 254 | emit browse( addressee().url().prettyURL() ); |
255 | break; | 255 | break; |
256 | } | 256 | } |
257 | if ( ( rc = mPainter->hitsPhone( point ) ) != -1 ) { | 257 | if ( ( rc = mPainter->hitsPhone( point ) ) != -1 ) { |
258 | // not implemented yet | 258 | // not implemented yet |
259 | break; | 259 | break; |
260 | } | 260 | } |
261 | if ( ( rc = mPainter->hitsTalk( point ) ) != -1 ) { | 261 | if ( ( rc = mPainter->hitsTalk( point ) ) != -1 ) { |
262 | // not implemented yet | 262 | // not implemented yet |
263 | break; | 263 | break; |
264 | } | 264 | } |
265 | break; | 265 | break; |
266 | default: | 266 | default: |
267 | break; | 267 | break; |
268 | } | 268 | } |
269 | 269 | ||
270 | mMenuBorderedBG = 0; | 270 | mMenuBorderedBG = 0; |
271 | mMenuTiledBG = 0; | 271 | mMenuTiledBG = 0; |
272 | } | 272 | } |
273 | 273 | ||
274 | void KABDetailedView::setAddressee( const KABC::Addressee &addr ) | 274 | void KABDetailedView::setAddressee( const KABC::Addressee &addr ) |
275 | { | 275 | { |
276 | BackgroundStyle style = None; | 276 | BackgroundStyle style = None; |
277 | QString dir, file, styleSetting; | 277 | QString dir, file, styleSetting; |
278 | KABBasicLook::setAddressee( addr ); | 278 | KABBasicLook::setAddressee( addr ); |
279 | 279 | ||
280 | // TODO: preload path and styleSetting with possible preference values | 280 | // TODO: preload path and styleSetting with possible preference values |
281 | styleSetting = addressee().custom( "kab", "BackgroundStyle" ); | 281 | styleSetting = addressee().custom( "kab", "BackgroundStyle" ); |
282 | style = (BackgroundStyle)styleSetting.toInt(); | 282 | style = (BackgroundStyle)styleSetting.toInt(); |
283 | file = addressee().custom( "kab", "BackgroundImage" ); | 283 | file = addressee().custom( "kab", "BackgroundImage" ); |
284 | if ( !file.isEmpty() ) { | 284 | if ( !file.isEmpty() ) { |
285 | switch ( style ) { | 285 | switch ( style ) { |
286 | case Tiled: | 286 | case Tiled: |
287 | dir = mTiledBGDir; | 287 | dir = mTiledBGDir; |
288 | break; | 288 | break; |
289 | case Bordered: | 289 | case Bordered: |
290 | dir = mBorderedBGDir; | 290 | dir = mBorderedBGDir; |
291 | break; | 291 | break; |
292 | case None: | 292 | case None: |
293 | default: | 293 | default: |
294 | break; | 294 | break; |
295 | } | 295 | } |
296 | 296 | ||
297 | QStringList dirs = KGlobal::instance()->dirs()->findDirs( "data", dir ); | 297 | QStringList dirs = KGlobal::instance()->dirs()->findDirs( "data", dir ); |
298 | mBackgroundStyle = None; | 298 | mBackgroundStyle = None; |
299 | if ( !dirs.isEmpty() ) { | 299 | if ( !dirs.isEmpty() ) { |
300 | uint count = 0; | 300 | uint count = 0; |
301 | for ( ; count < dirs.count(); ++count ) { | 301 | for ( ; count < dirs.count(); ++count ) { |
302 | QDir folder; | 302 | QDir folder; |
303 | folder.setPath( dirs[ count ] ); | 303 | folder.setPath( dirs[ count ] ); |
304 | file = folder.absPath() + "/" + file; | 304 | file = folder.absPath() + "/" + file; |
305 | if ( getBackground( file, mCurrentBackground ) ) { | 305 | if ( getBackground( file, mCurrentBackground ) ) { |
306 | mBackgroundStyle = style; | 306 | mBackgroundStyle = style; |
307 | break; | 307 | break; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | if ( count == dirs.count() ) { | 311 | if ( count == dirs.count() ) { |
312 | kdDebug(5720) << "KABDetailedView::setEntry: " << file | 312 | kdDebug(5720) << "KABDetailedView::setEntry: " << file |
313 | << " not locatable." << endl; | 313 | << " not locatable." << endl; |
314 | } | 314 | } |
315 | } | 315 | } |
316 | } else { // no background here | 316 | } else { // no background here |
317 | mBackgroundStyle = None; | 317 | mBackgroundStyle = None; |
318 | mCurrentBackground.resize( 0, 0 ); | 318 | mCurrentBackground.resize( 0, 0 ); |
319 | } | 319 | } |
320 | 320 | ||
321 | repaint( false ); | 321 | repaint( false ); |
322 | } | 322 | } |
323 | 323 | ||
324 | void KABDetailedView::slotBorderedBGSelected( int index ) | 324 | void KABDetailedView::slotBorderedBGSelected( int index ) |
325 | { | 325 | { |
326 | if ( index >= 0 && (uint)index < mBorders.count() && !isReadOnly() ) { | 326 | if ( index >= 0 && (uint)index < mBorders.count() && !isReadOnly() ) { |
327 | // get the selection and make it a full path | 327 | // get the selection and make it a full path |
328 | QString path = mBorders[ index ]; | 328 | QString path = mBorders[ index ]; |
329 | mBackgroundStyle = Bordered; | 329 | mBackgroundStyle = Bordered; |
330 | addressee().insertCustom( "kab", "BackgroundStyle", | 330 | addressee().insertCustom( "kab", "BackgroundStyle", |
331 | QString().setNum( mBackgroundStyle ) ); | 331 | QString().setNum( mBackgroundStyle ) ); |
332 | addressee().insertCustom( "kab", "BackgroundImage", path ); | 332 | addressee().insertCustom( "kab", "BackgroundImage", path ); |
333 | setAddressee( addressee() ); | 333 | setAddressee( addressee() ); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
337 | void KABDetailedView::slotTiledBGSelected( int index ) | 337 | void KABDetailedView::slotTiledBGSelected( int index ) |
338 | { | 338 | { |
339 | if ( index >= 0 && (uint)index < mTiles.count() && !isReadOnly() ) { | 339 | if ( index >= 0 && (uint)index < mTiles.count() && !isReadOnly() ) { |
340 | QString path = mTiles[ index ]; | 340 | QString path = mTiles[ index ]; |
341 | mBackgroundStyle = Tiled; | 341 | mBackgroundStyle = Tiled; |
342 | addressee().insertCustom( "kab", "BackgroundStyle", | 342 | addressee().insertCustom( "kab", "BackgroundStyle", |
343 | QString().setNum( mBackgroundStyle ) ); | 343 | QString().setNum( mBackgroundStyle ) ); |
344 | addressee().insertCustom( "kab", "BackgroundImage", path ); | 344 | addressee().insertCustom( "kab", "BackgroundImage", path ); |
345 | setAddressee( addressee() ); | 345 | setAddressee( addressee() ); |
346 | } | 346 | } |
347 | } | 347 | } |
348 | 348 | ||
349 | void KABDetailedView::setReadOnly( bool state ) | 349 | void KABDetailedView::setReadOnly( bool state ) |
350 | { | 350 | { |
351 | KABBasicLook::setReadOnly( state ); | 351 | KABBasicLook::setReadOnly( state ); |
352 | repaint( false ); | 352 | repaint( false ); |
353 | } | 353 | } |
354 | 354 | ||
355 | void KABDetailedView::restoreSettings( KConfig *config ) | 355 | void KABDetailedView::restoreSettings( KConfig *config ) |
356 | { | 356 | { |
357 | QFont general = KGlobalSettings::generalFont(); | 357 | QFont general = KGlobalSettings::generalFont(); |
358 | QFont fixed = KGlobalSettings::fixedFont(); | 358 | QFont fixed = KGlobalSettings::fixedFont(); |
359 | QString gfont = general.family(); | 359 | QString gfont = general.family(); |
360 | QString ffont = fixed.family(); | 360 | QString ffont = fixed.family(); |
361 | 361 | ||
362 | int gpointsize = general.pixelSize(); | 362 | int gpointsize = general.pixelSize(); |
363 | if ( gpointsize == -1 ) | 363 | if ( gpointsize == -1 ) |
364 | gpointsize = general.pointSize(); | 364 | gpointsize = general.pointSize(); |
365 | 365 | ||
366 | int fpointsize = fixed.pixelSize(); | 366 | int fpointsize = fixed.pixelSize(); |
367 | if ( fpointsize == -1 ) | 367 | if ( fpointsize == -1 ) |
368 | fpointsize = fixed.pointSize(); | 368 | fpointsize = fixed.pointSize(); |
369 | 369 | ||
370 | config->setGroup( ConfigView ); | 370 | config->setGroup( ConfigView ); |
371 | 371 | ||
372 | // load the default background image: | 372 | // load the default background image: |
373 | QString bgImage; | 373 | QString bgImage; |
374 | mUseDefaultBGImage = config->readBoolEntry( ConfigView_UseDefaultBackground, true ); | 374 | mUseDefaultBGImage = config->readBoolEntry( ConfigView_UseDefaultBackground, true ); |
375 | mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white ); | 375 | mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white ); |
376 | bgImage = config->readEntry( ConfigView_DefaultBackgroundImage, "konqueror/tiles/kenwimer.png" ); | 376 | bgImage = config->readEntry( ConfigView_DefaultBackgroundImage, "konqueror/tiles/kenwimer.png" ); |
377 | 377 | ||
378 | if ( mUseDefaultBGImage ) { | 378 | if ( mUseDefaultBGImage ) { |
379 | uint count = 0; | 379 | uint count = 0; |
380 | QStringList dirs = KGlobal::instance()->dirs()->findDirs( "data", "/" ); | 380 | QStringList dirs = KGlobal::instance()->dirs()->findDirs( "data", "/" ); |
381 | if ( !dirs.isEmpty() ) { | 381 | if ( !dirs.isEmpty() ) { |
382 | for ( count = 0; count < dirs.count(); ++count ) { | 382 | for ( count = 0; count < dirs.count(); ++count ) { |
383 | if ( getBackground( dirs[ count ] + "/" + bgImage, mDefaultBGImage ) ) | 383 | if ( getBackground( dirs[ count ] + "/" + bgImage, mDefaultBGImage ) ) |
384 | break; | 384 | break; |
385 | } | 385 | } |
386 | } | 386 | } |
387 | 387 | ||
388 | if ( count == dirs.count() ) { | 388 | if ( count == dirs.count() ) { |
389 | mUseDefaultBGImage = getBackground( bgImage, mDefaultBGImage ); | 389 | mUseDefaultBGImage = getBackground( bgImage, mDefaultBGImage ); |
390 | if ( !mUseDefaultBGImage ) | 390 | if ( !mUseDefaultBGImage ) |
391 | kdDebug(5720) << "KABDetailedView::configure: " | 391 | kdDebug(5720) << "KABDetailedView::configure: " |
392 | << "default BG image selected, but could not be loaded." | 392 | << "default BG image selected, but could not be loaded." |
393 | << endl; | 393 | << endl; |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white ); | 397 | mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white ); |
398 | mHeadLineBGColor = config->readColorEntry( ConfigView_HeadlineBGColor, &darkBlue ); | 398 | mHeadLineBGColor = config->readColorEntry( ConfigView_HeadlineBGColor, &darkBlue ); |
399 | mHeadLineTextColor = config->readColorEntry( ConfigView_HeadlineTextColor, &yellow ); | 399 | mHeadLineTextColor = config->readColorEntry( ConfigView_HeadlineTextColor, &yellow ); |
400 | mUseHeadLineBGColor = config->readBoolEntry( ConfigView_UseHeadlineBGColor, true ); | 400 | mUseHeadLineBGColor = config->readBoolEntry( ConfigView_UseHeadlineBGColor, true ); |
401 | 401 | ||
402 | if ( !mPainter ) | 402 | if ( !mPainter ) |
403 | mPainter = new KABEntryPainter; | 403 | mPainter = new KABEntryPainter; |
404 | 404 | ||
405 | mPainter->setForegroundColor( black ); | 405 | mPainter->setForegroundColor( black ); |
406 | mPainter->setHeaderColor( mHeadLineTextColor ); | 406 | mPainter->setHeaderColor( mHeadLineTextColor ); |
407 | mPainter->setUseHeaderColor( mUseHeadLineBGColor ); | 407 | mPainter->setUseHeaderColor( mUseHeadLineBGColor ); |
408 | mPainter->setBackgroundColor( mHeadLineBGColor ); | 408 | mPainter->setBackgroundColor( mHeadLineBGColor ); |
409 | 409 | ||
410 | mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) ); | 410 | mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) ); |
411 | mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) ); | 411 | mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) ); |
412 | mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); | 412 | mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); |
413 | mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) ); | 413 | mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) ); |
414 | mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); | 414 | mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); |
415 | } | 415 | } |
416 | 416 | ||
417 | #ifndef KAB_EMBEDDED | 417 | #ifndef KAB_EMBEDDED_ |
418 | #include "look_details.moc" | 418 | #include "moc_look_details.cpp" |
419 | #endif //KAB_EMBEDDED | 419 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/look_details.h b/kaddressbook/details/look_details.h index e8d50a9..b59d3a7 100644 --- a/kaddressbook/details/look_details.h +++ b/kaddressbook/details/look_details.h | |||
@@ -1,157 +1,157 @@ | |||
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_DETAILS_H | 24 | #ifndef LOOK_DETAILS_H |
25 | #define LOOK_DETAILS_H | 25 | #define LOOK_DETAILS_H |
26 | 26 | ||
27 | #include <kabc/addressbook.h> | 27 | #include <kabc/addressbook.h> |
28 | #include <kaction.h> | 28 | #include <kaction.h> |
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | 30 | ||
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qpixmap.h> | 32 | #include <qpixmap.h> |
33 | #include <qptrlist.h> | 33 | #include <qptrlist.h> |
34 | #include <qrect.h> | 34 | #include <qrect.h> |
35 | 35 | ||
36 | #include "look_basic.h" | 36 | #include "look_basic.h" |
37 | 37 | ||
38 | class KABEntryPainter; | 38 | class KABEntryPainter; |
39 | class QComboBox; | 39 | class QComboBox; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | This class implements the detailed view. | 42 | This class implements the detailed view. |
43 | Currently, there is no possibility to change the entry in this | 43 | Currently, there is no possibility to change the entry in this |
44 | view. | 44 | view. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | class KABDetailedView : public KABBasicLook | 47 | class KABDetailedView : public KABBasicLook |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | 50 | ||
51 | public: | 51 | public: |
52 | /** | 52 | /** |
53 | Enum to select how the background is drawn. | 53 | Enum to select how the background is drawn. |
54 | */ | 54 | */ |
55 | enum BackgroundStyle | 55 | enum BackgroundStyle |
56 | { | 56 | { |
57 | None, | 57 | None, |
58 | Tiled, | 58 | Tiled, |
59 | Bordered | 59 | Bordered |
60 | }; | 60 | }; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | The constructor. | 63 | The constructor. |
64 | */ | 64 | */ |
65 | KABDetailedView( QWidget *parent = 0, const char* name = 0 ); | 65 | KABDetailedView( QWidget *parent = 0, const char* name = 0 ); |
66 | 66 | ||
67 | /** | 67 | /** |
68 | The virtual destructor. | 68 | The virtual destructor. |
69 | */ | 69 | */ |
70 | virtual ~KABDetailedView(); | 70 | virtual ~KABDetailedView(); |
71 | 71 | ||
72 | /** | 72 | /** |
73 | Set the addressee. | 73 | Set the addressee. |
74 | */ | 74 | */ |
75 | void setAddressee( const KABC::Addressee& ); | 75 | void setAddressee( const KABC::Addressee& ); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | Overloaded from KABBasicLook. | 78 | Overloaded from KABBasicLook. |
79 | */ | 79 | */ |
80 | void setReadOnly( bool ); | 80 | void setReadOnly( bool ); |
81 | 81 | ||
82 | /** | 82 | /** |
83 | Overloaded from KABBasicLook. | 83 | Overloaded from KABBasicLook. |
84 | */ | 84 | */ |
85 | void restoreSettings( KConfig* ); | 85 | void restoreSettings( KConfig* ); |
86 | 86 | ||
87 | public slots: | 87 | public slots: |
88 | void slotBorderedBGSelected( int index ); | 88 | void slotBorderedBGSelected( int index ); |
89 | void slotTiledBGSelected( int index ); | 89 | void slotTiledBGSelected( int index ); |
90 | 90 | ||
91 | protected: | 91 | protected: |
92 | void paintEvent( QPaintEvent* ); | 92 | void paintEvent( QPaintEvent* ); |
93 | void mousePressEvent( QMouseEvent* ); | 93 | void mousePressEvent( QMouseEvent* ); |
94 | void mouseMoveEvent( QMouseEvent* ); | 94 | void mouseMoveEvent( QMouseEvent* ); |
95 | 95 | ||
96 | /** | 96 | /** |
97 | A method to retrieve a background image according to the path | 97 | A method to retrieve a background image according to the path |
98 | stored in the entry. It is either loaded | 98 | stored in the entry. It is either loaded |
99 | from backgrounds, that acts as a cache, or from the file | 99 | from backgrounds, that acts as a cache, or from the file |
100 | and added to @see backgrounds. | 100 | and added to @see backgrounds. |
101 | */ | 101 | */ |
102 | bool getBackground( QString path, QPixmap& image ); | 102 | bool getBackground( QString path, QPixmap& image ); |
103 | 103 | ||
104 | private: | 104 | private: |
105 | QPtrList<QRect> mURLRects; | 105 | QPtrList<QRect> mURLRects; |
106 | QPtrList<QRect> mEmailRects; | 106 | QPtrList<QRect> mEmailRects; |
107 | QPtrList<QRect> mPhoneRects; | 107 | QPtrList<QRect> mPhoneRects; |
108 | KABEntryPainter *mPainter; | 108 | KABEntryPainter *mPainter; |
109 | 109 | ||
110 | QMap<QString, QPixmap> mBackgroundMap; | 110 | QMap<QString, QPixmap> mBackgroundMap; |
111 | QPixmap mCurrentBackground; | 111 | QPixmap mCurrentBackground; |
112 | 112 | ||
113 | BackgroundStyle mBackgroundStyle; | 113 | BackgroundStyle mBackgroundStyle; |
114 | 114 | ||
115 | bool mUseDefaultBGImage; | 115 | bool mUseDefaultBGImage; |
116 | bool mUseHeadLineBGColor; | 116 | bool mUseHeadLineBGColor; |
117 | 117 | ||
118 | QColor mDefaultBGColor; | 118 | QColor mDefaultBGColor; |
119 | QColor mHeadLineBGColor; | 119 | QColor mHeadLineBGColor; |
120 | QColor mHeadLineTextColor; | 120 | QColor mHeadLineTextColor; |
121 | 121 | ||
122 | QPixmap mDefaultBGImage; | 122 | QPixmap mDefaultBGImage; |
123 | 123 | ||
124 | KToggleAction *mActionShowAddresses; | 124 | KToggleAction *mActionShowAddresses; |
125 | KToggleAction *mActionShowEmails; | 125 | KToggleAction *mActionShowEmails; |
126 | KToggleAction *mActionShowPhones; | 126 | KToggleAction *mActionShowPhones; |
127 | KToggleAction *mActionShowURLs; | 127 | KToggleAction *mActionShowURLs; |
128 | 128 | ||
129 | const int mGrid; | 129 | const int mGrid; |
130 | QStringList mBorders; | 130 | QStringList mBorders; |
131 | QStringList mTiles; | 131 | QStringList mTiles; |
132 | 132 | ||
133 | QPopupMenu *mMenuBorderedBG; | 133 | Q3PopupMenu *mMenuBorderedBG; |
134 | QPopupMenu *mMenuTiledBG; | 134 | Q3PopupMenu *mMenuTiledBG; |
135 | 135 | ||
136 | static const QString mBorderedBGDir; | 136 | static const QString mBorderedBGDir; |
137 | static const QString mTiledBGDir; | 137 | static const QString mTiledBGDir; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | class KABDetailedViewFactory : public KABLookFactory | 140 | class KABDetailedViewFactory : public KABLookFactory |
141 | { | 141 | { |
142 | public: | 142 | public: |
143 | KABDetailedViewFactory( QWidget *parent = 0, const char *name = 0 ) | 143 | KABDetailedViewFactory( QWidget *parent = 0, const char *name = 0 ) |
144 | : KABLookFactory( parent, name ) {} | 144 | : KABLookFactory( parent, name ) {} |
145 | 145 | ||
146 | KABBasicLook *create() | 146 | KABBasicLook *create() |
147 | { | 147 | { |
148 | return new KABDetailedView( mParent, mName ); | 148 | return new KABDetailedView( mParent, mName ); |
149 | } | 149 | } |
150 | 150 | ||
151 | QString description() | 151 | QString description() |
152 | { | 152 | { |
153 | return i18n( "Detailed Style: Display all details, no modifications." ); | 153 | return i18n( "Detailed Style: Display all details, no modifications." ); |
154 | } | 154 | } |
155 | }; | 155 | }; |
156 | 156 | ||
157 | #endif | 157 | #endif |
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp index bb30650..4ec1c7d 100644 --- a/kaddressbook/details/look_html.cpp +++ b/kaddressbook/details/look_html.cpp | |||
@@ -1,56 +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 <q3scrollview.h> |
28 | #include "kabprefs.h" | 28 | #include "kabprefs.h" |
29 | #include <kabc/addresseeview.h> | 29 | #include <kabc/addresseeview.h> |
30 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) | 30 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) |
31 | : KABBasicLook( parent, name ) | 31 | : KABBasicLook( parent, name ) |
32 | { | 32 | { |
33 | mView = new KABC::AddresseeView( this ); | 33 | mView = new KABC::AddresseeView( this ); |
34 | mView->setFont( KABPrefs::instance()->mDetailsFont ); | 34 | mView->setFont( KABPrefs::instance()->mDetailsFont ); |
35 | connect(this, SIGNAL(printMyView()), | 35 | connect(this, SIGNAL(printMyView()), |
36 | this , SLOT(printMe())); | 36 | this , SLOT(printMe())); |
37 | } | 37 | } |
38 | 38 | ||
39 | KABHtmlView::~KABHtmlView() | 39 | KABHtmlView::~KABHtmlView() |
40 | { | 40 | { |
41 | } | 41 | } |
42 | void KABHtmlView::printMe() | 42 | void KABHtmlView::printMe() |
43 | { | 43 | { |
44 | mView->printMe(); | 44 | mView->printMe(); |
45 | 45 | ||
46 | } | 46 | } |
47 | 47 | ||
48 | void KABHtmlView::setAddressee( const KABC::Addressee &addr ) | 48 | void KABHtmlView::setAddressee( const KABC::Addressee &addr ) |
49 | { | 49 | { |
50 | mView->setFont( KABPrefs::instance()->mDetailsFont ); | 50 | mView->setFont( KABPrefs::instance()->mDetailsFont ); |
51 | mView->setAddressee( addr ); | 51 | mView->setAddressee( addr ); |
52 | } | 52 | } |
53 | 53 | ||
54 | #ifndef KAB_EMBEDDED | 54 | #ifndef KAB_EMBEDDED_ |
55 | #include "look_html.moc" | 55 | #include "moc_look_html.cpp" |
56 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |