-rw-r--r-- | kaddressbook/details/detailsviewcontainer.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.h | 1 |
2 files changed, 1 insertions, 11 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp index ceffc77..229cce0 100644 --- a/kaddressbook/details/detailsviewcontainer.cpp +++ b/kaddressbook/details/detailsviewcontainer.cpp | |||
@@ -100,70 +100,61 @@ void ViewContainer::slotStyleSelected( int index ) | |||
100 | { | 100 | { |
101 | #ifndef KAB_EMBEDDED | 101 | #ifndef KAB_EMBEDDED |
102 | KConfig *config = kapp->config(); | 102 | KConfig *config = kapp->config(); |
103 | #else //KAB_EMBEDDED | 103 | #else //KAB_EMBEDDED |
104 | //US I hope I got the same config object as above expected. | 104 | //US I hope I got the same config object as above expected. |
105 | KConfig *config = KABPrefs::instance()->getConfig(); | 105 | KConfig *config = KABPrefs::instance()->getConfig(); |
106 | #endif //KAB_EMBEDDED | 106 | #endif //KAB_EMBEDDED |
107 | KABC::Addressee addr; | 107 | KABC::Addressee addr; |
108 | 108 | ||
109 | if ( index >= 0 && index < mStyleCombo->count() ) { | 109 | if ( index >= 0 && index < mStyleCombo->count() ) { |
110 | if ( mCurrentLook != 0 ) { | 110 | if ( mCurrentLook != 0 ) { |
111 | mCurrentLook->saveSettings( config ); | 111 | mCurrentLook->saveSettings( config ); |
112 | addr = mCurrentLook->addressee(); | 112 | addr = mCurrentLook->addressee(); |
113 | 113 | ||
114 | delete mCurrentLook; | 114 | delete mCurrentLook; |
115 | mCurrentLook = 0; | 115 | mCurrentLook = 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | KABLookFactory *factory = mLookFactories.at( index ); | 118 | KABLookFactory *factory = mLookFactories.at( index ); |
119 | 119 | ||
120 | mCurrentLook = factory->create(); | 120 | mCurrentLook = factory->create(); |
121 | mDetailsStack->raiseWidget( mCurrentLook ); | 121 | mDetailsStack->raiseWidget( mCurrentLook ); |
122 | 122 | ||
123 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, | 123 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, |
124 | SIGNAL( sendEmail( const QString& ) ) ); | 124 | SIGNAL( sendEmail( const QString& ) ) ); |
125 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, | 125 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, |
126 | SIGNAL( browse( const QString& ) ) ); | 126 | SIGNAL( browse( const QString& ) ) ); |
127 | } | 127 | } |
128 | 128 | ||
129 | mCurrentLook->restoreSettings( config ); | 129 | mCurrentLook->restoreSettings( config ); |
130 | mCurrentLook->setAddressee( addr ); | 130 | mCurrentLook->setAddressee( addr ); |
131 | } | 131 | } |
132 | void ViewContainer::refreshView() | ||
133 | { | ||
134 | if ( mCurrentLook ) { | ||
135 | mCurrentLook->setAddressee( mCurrentAddressee ); | ||
136 | } | ||
137 | } | ||
138 | 132 | ||
139 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) | 133 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) |
140 | { | 134 | { |
141 | if ( mCurrentLook != 0 ) { | 135 | if ( mCurrentLook != 0 ) { |
142 | if ( addressee == mCurrentAddressee ) | ||
143 | return; | ||
144 | else { | ||
145 | mCurrentAddressee = addressee; | 136 | mCurrentAddressee = addressee; |
146 | mCurrentLook->setAddressee( mCurrentAddressee ); | 137 | mCurrentLook->setAddressee( mCurrentAddressee ); |
147 | } | 138 | |
148 | } | 139 | } |
149 | } | 140 | } |
150 | 141 | ||
151 | KABC::Addressee ViewContainer::addressee() | 142 | KABC::Addressee ViewContainer::addressee() |
152 | { | 143 | { |
153 | static KABC::Addressee empty; // do not use! | 144 | static KABC::Addressee empty; // do not use! |
154 | 145 | ||
155 | if ( !mCurrentLook ) | 146 | if ( !mCurrentLook ) |
156 | return empty; | 147 | return empty; |
157 | else | 148 | else |
158 | return mCurrentLook->addressee(); | 149 | return mCurrentLook->addressee(); |
159 | } | 150 | } |
160 | 151 | ||
161 | void ViewContainer::setReadOnly( bool state ) | 152 | void ViewContainer::setReadOnly( bool state ) |
162 | { | 153 | { |
163 | if ( mCurrentLook ) | 154 | if ( mCurrentLook ) |
164 | mCurrentLook->setReadOnly( state ); | 155 | mCurrentLook->setReadOnly( state ); |
165 | } | 156 | } |
166 | 157 | ||
167 | #ifndef KAB_EMBEDDED | 158 | #ifndef KAB_EMBEDDED |
168 | #include "detailsviewcontainer.moc" | 159 | #include "detailsviewcontainer.moc" |
169 | #endif //KAB_EMBEDDED | 160 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h index b561d12..667f0cb 100644 --- a/kaddressbook/details/detailsviewcontainer.h +++ b/kaddressbook/details/detailsviewcontainer.h | |||
@@ -16,65 +16,64 @@ | |||
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 | void refreshView(); | ||
49 | /** | 48 | /** |
50 | Return the contact currently displayed. | 49 | Return the contact currently displayed. |
51 | */ | 50 | */ |
52 | KABC::Addressee addressee(); | 51 | KABC::Addressee addressee(); |
53 | 52 | ||
54 | public slots: | 53 | public slots: |
55 | /** | 54 | /** |
56 | Set the contact currently displayed. | 55 | Set the contact currently displayed. |
57 | */ | 56 | */ |
58 | void setAddressee( const KABC::Addressee& addressee ); | 57 | void setAddressee( const KABC::Addressee& addressee ); |
59 | 58 | ||
60 | /** | 59 | /** |
61 | Set read-write state. | 60 | Set read-write state. |
62 | */ | 61 | */ |
63 | void setReadOnly( bool state ); | 62 | void setReadOnly( bool state ); |
64 | 63 | ||
65 | signals: | 64 | signals: |
66 | /** | 65 | /** |
67 | The contact has been changed. | 66 | The contact has been changed. |
68 | */ | 67 | */ |
69 | void addresseeChanged(); | 68 | void addresseeChanged(); |
70 | 69 | ||
71 | /** | 70 | /** |
72 | The user acticated the email address displayed. This may happen | 71 | The user acticated the email address displayed. This may happen |
73 | by, for example, clicking on the displayed mailto-URL. | 72 | by, for example, clicking on the displayed mailto-URL. |
74 | */ | 73 | */ |
75 | void sendEmail( const QString& ); | 74 | void sendEmail( const QString& ); |
76 | 75 | ||
77 | /** | 76 | /** |
78 | The user activated one of the displayed HTTP URLs. For example | 77 | The user activated one of the displayed HTTP URLs. For example |
79 | by clicking on the displayed homepage address. | 78 | by clicking on the displayed homepage address. |
80 | */ | 79 | */ |