Diffstat (limited to 'kaddressbook/imagewidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/imagewidget.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index eec5e08..6ecf66d 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp | |||
@@ -1,297 +1,301 @@ | |||
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 <kabc/picture.h> | 24 | #include <kabc/picture.h> |
25 | 25 | ||
26 | #ifndef KAB_EMBEDDED | 26 | #ifndef KAB_EMBEDDED |
27 | #include <kaccelmanager.h> | 27 | #include <kaccelmanager.h> |
28 | #include <kio/netaccess.h> | 28 | #include <kio/netaccess.h> |
29 | #include <kimageio.h> | 29 | #include <kimageio.h> |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kdialog.h> | 33 | #include <kdialog.h> |
34 | #include <kiconloader.h> | 34 | #include <kiconloader.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kurlrequester.h> | 36 | #include <kurlrequester.h> |
37 | #include <kurl.h> | 37 | #include <kurl.h> |
38 | 38 | ||
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qgroupbox.h> | 40 | #include <q3groupbox.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <QDesktopWidget> | ||
47 | //Added by qt3to4: | ||
48 | #include <Q3GridLayout> | ||
49 | #include <Q3Frame> | ||
46 | 50 | ||
47 | #include "imagewidget.h" | 51 | #include "imagewidget.h" |
48 | 52 | ||
49 | ImageWidget::ImageWidget( QWidget *parent, const char *name ) | 53 | ImageWidget::ImageWidget( QWidget *parent, const char *name ) |
50 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
51 | { | 55 | { |
52 | QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(), | 56 | Q3GridLayout *topLayout = new Q3GridLayout( this, 2, 1, KDialog::marginHint(), |
53 | KDialog::spacingHint() ); | 57 | KDialog::spacingHint() ); |
54 | 58 | ||
55 | QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); | 59 | Q3GroupBox *photoBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); |
56 | QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, | 60 | Q3GridLayout *boxLayout = new Q3GridLayout( photoBox->layout(), 3, 2, |
57 | KDialog::spacingHint() ); | 61 | KDialog::spacingHint() ); |
58 | boxLayout->setRowStretch( 2, 1 ); | 62 | boxLayout->setRowStretch( 2, 1 ); |
59 | 63 | ||
60 | mPhotoLabel = new QLabel( photoBox ); | 64 | mPhotoLabel = new QLabel( photoBox ); |
61 | int fac = 9; | 65 | int fac = 9; |
62 | if ( QApplication::desktop()->width() > 320 ) | 66 | if ( QApplication::desktop()->width() > 320 ) |
63 | fac = 6; | 67 | fac = 6; |
64 | mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); | 68 | mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); |
65 | mPhotoLabel->setScaledContents( true ); | 69 | mPhotoLabel->setScaledContents( true ); |
66 | mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 70 | mPhotoLabel->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken ); |
67 | boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 ); | 71 | boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 ); |
68 | 72 | ||
69 | mPhotoUrl = new KURLRequester( photoBox ); | 73 | mPhotoUrl = new KURLRequester( photoBox ); |
70 | #ifndef KAB_EMBEDDED | 74 | #ifndef KAB_EMBEDDED |
71 | mPhotoUrl->setFilter( KImageIO::pattern() ); | 75 | mPhotoUrl->setFilter( KImageIO::pattern() ); |
72 | #else //KAB_EMBEDDED | 76 | #else //KAB_EMBEDDED |
73 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); | 77 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); |
74 | #endif //KAB_EMBEDDED | 78 | #endif //KAB_EMBEDDED |
75 | 79 | ||
76 | 80 | ||
77 | boxLayout->addWidget( mPhotoUrl, 0, 1 ); | 81 | boxLayout->addWidget( mPhotoUrl, 0, 1 ); |
78 | QHBox *hb1 = new QHBox ( photoBox ); | 82 | Q3HBox *hb1 = new Q3HBox ( photoBox ); |
79 | mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 ); | 83 | mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 ); |
80 | mUsePhotoUrl->setEnabled( false ); | 84 | mUsePhotoUrl->setEnabled( false ); |
81 | boxLayout->addWidget( hb1, 1, 1 ); | 85 | boxLayout->addWidget( hb1, 1, 1 ); |
82 | 86 | ||
83 | QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 ); | 87 | QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 ); |
84 | connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) ); | 88 | connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) ); |
85 | boxLayout->addWidget( new QLabel( photoBox ), 2, 1 ); | 89 | boxLayout->addWidget( new QLabel( photoBox ), 2, 1 ); |
86 | 90 | ||
87 | topLayout->addWidget( photoBox, 0, 0 ); | 91 | topLayout->addWidget( photoBox, 0, 0 ); |
88 | 92 | ||
89 | QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); | 93 | Q3GroupBox *logoBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); |
90 | boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); | 94 | boxLayout = new Q3GridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); |
91 | boxLayout->setRowStretch( 2, 1 ); | 95 | boxLayout->setRowStretch( 2, 1 ); |
92 | 96 | ||
93 | mLogoLabel = new QLabel( logoBox ); | 97 | mLogoLabel = new QLabel( logoBox ); |
94 | mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); | 98 | mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); |
95 | mLogoLabel->setScaledContents( true ); | 99 | mLogoLabel->setScaledContents( true ); |
96 | mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 100 | mLogoLabel->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken ); |
97 | boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 ); | 101 | boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 ); |
98 | 102 | ||
99 | mLogoUrl = new KURLRequester( logoBox ); | 103 | mLogoUrl = new KURLRequester( logoBox ); |
100 | #ifndef KAB_EMBEDDED | 104 | #ifndef KAB_EMBEDDED |
101 | mLogoUrl->setFilter( KImageIO::pattern() ); | 105 | mLogoUrl->setFilter( KImageIO::pattern() ); |
102 | #else //KAB_EMBEDDED | 106 | #else //KAB_EMBEDDED |
103 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); | 107 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); |
104 | #endif //KAB_EMBEDDED | 108 | #endif //KAB_EMBEDDED |
105 | boxLayout->addWidget( mLogoUrl, 0, 1 ); | 109 | boxLayout->addWidget( mLogoUrl, 0, 1 ); |
106 | 110 | ||
107 | QHBox *hb2 = new QHBox ( logoBox ); | 111 | Q3HBox *hb2 = new Q3HBox ( logoBox ); |
108 | mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 ); | 112 | mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 ); |
109 | mUseLogoUrl->setEnabled( false ); | 113 | mUseLogoUrl->setEnabled( false ); |
110 | boxLayout->addWidget( hb2, 1, 1 ); | 114 | boxLayout->addWidget( hb2, 1, 1 ); |
111 | 115 | ||
112 | pb = new QPushButton( i18n( "Remove" ), hb2 ); | 116 | pb = new QPushButton( i18n( "Remove" ), hb2 ); |
113 | connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) ); | 117 | connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) ); |
114 | boxLayout->addWidget( new QLabel( logoBox ), 2, 1 ); | 118 | boxLayout->addWidget( new QLabel( logoBox ), 2, 1 ); |
115 | topLayout->addWidget( logoBox, 1, 0 ); | 119 | topLayout->addWidget( logoBox, 1, 0 ); |
116 | 120 | ||
117 | connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), | 121 | connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), |
118 | SIGNAL( changed() ) ); | 122 | SIGNAL( changed() ) ); |
119 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 123 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
120 | SLOT( loadPhoto() ) ); | 124 | SLOT( loadPhoto() ) ); |
121 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 125 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
122 | SIGNAL( changed() ) ); | 126 | SIGNAL( changed() ) ); |
123 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 127 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
124 | SLOT( updateGUI() ) ); | 128 | SLOT( updateGUI() ) ); |
125 | connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ), | 129 | connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ), |
126 | SIGNAL( changed() ) ); | 130 | SIGNAL( changed() ) ); |
127 | 131 | ||
128 | connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ), | 132 | connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ), |
129 | SIGNAL( changed() ) ); | 133 | SIGNAL( changed() ) ); |
130 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), | 134 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), |
131 | SLOT( loadLogo() ) ); | 135 | SLOT( loadLogo() ) ); |
132 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), | 136 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), |
133 | SIGNAL( changed() ) ); | 137 | SIGNAL( changed() ) ); |
134 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), | 138 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), |
135 | SLOT( updateGUI() ) ); | 139 | SLOT( updateGUI() ) ); |
136 | connect( mUseLogoUrl, SIGNAL( toggled( bool ) ), | 140 | connect( mUseLogoUrl, SIGNAL( toggled( bool ) ), |
137 | SIGNAL( changed() ) ); | 141 | SIGNAL( changed() ) ); |
138 | 142 | ||
139 | #ifndef KAB_EMBEDDED | 143 | #ifndef KAB_EMBEDDED |
140 | KAcceleratorManager::manage( this ); | 144 | KAcceleratorManager::manage( this ); |
141 | #endif //KAB_EMBEDDED | 145 | #endif //KAB_EMBEDDED |
142 | 146 | ||
143 | } | 147 | } |
144 | 148 | ||
145 | ImageWidget::~ImageWidget() | 149 | ImageWidget::~ImageWidget() |
146 | { | 150 | { |
147 | } | 151 | } |
148 | 152 | ||
149 | void ImageWidget::setPhoto( const KABC::Picture &photo ) | 153 | void ImageWidget::setPhoto( const KABC::Picture &photo ) |
150 | { | 154 | { |
151 | bool blocked = signalsBlocked(); | 155 | bool blocked = signalsBlocked(); |
152 | blockSignals( true ); | 156 | blockSignals( true ); |
153 | 157 | ||
154 | if ( photo.isIntern() ) { | 158 | if ( photo.isIntern() ) { |
155 | //US | 159 | //US |
156 | //US mPhotoLabel->setPixmap( photo.data() ); | 160 | //US mPhotoLabel->setPixmap( photo.data() ); |
157 | if (photo.data().isNull() != true) | 161 | if (photo.data().isNull() != true) |
158 | { | 162 | { |
159 | QPixmap pm; | 163 | QPixmap pm; |
160 | pm.convertFromImage(photo.data()); | 164 | pm.convertFromImage(photo.data()); |
161 | 165 | ||
162 | mPhotoLabel->setPixmap( pm ); | 166 | mPhotoLabel->setPixmap( pm ); |
163 | } | 167 | } |
164 | 168 | ||
165 | mUsePhotoUrl->setChecked( false ); | 169 | mUsePhotoUrl->setChecked( false ); |
166 | } else { | 170 | } else { |
167 | mPhotoUrl->setURL( photo.url() ); | 171 | mPhotoUrl->setURL( photo.url() ); |
168 | if ( !photo.url().isEmpty() ) | 172 | if ( !photo.url().isEmpty() ) |
169 | mUsePhotoUrl->setChecked( true ); | 173 | mUsePhotoUrl->setChecked( true ); |
170 | loadPhoto(); | 174 | loadPhoto(); |
171 | } | 175 | } |
172 | 176 | ||
173 | blockSignals( blocked ); | 177 | blockSignals( blocked ); |
174 | } | 178 | } |
175 | 179 | ||
176 | KABC::Picture ImageWidget::photo() const | 180 | KABC::Picture ImageWidget::photo() const |
177 | { | 181 | { |
178 | KABC::Picture photo; | 182 | KABC::Picture photo; |
179 | 183 | ||
180 | if ( mUsePhotoUrl->isChecked() ) | 184 | if ( mUsePhotoUrl->isChecked() ) |
181 | photo.setUrl( mPhotoUrl->url() ); | 185 | photo.setUrl( mPhotoUrl->url() ); |
182 | else { | 186 | else { |
183 | QPixmap *px = mPhotoLabel->pixmap(); | 187 | const QPixmap *px = mPhotoLabel->pixmap(); |
184 | if ( px ) { | 188 | if ( px ) { |
185 | #ifndef KAB_EMBEDDED | 189 | #ifndef KAB_EMBEDDED |
186 | if ( px->height() > px->width() ) | 190 | if ( px->height() > px->width() ) |
187 | photo.setData( px->convertToImage().scaleHeight( 140 ) ); | 191 | photo.setData( px->convertToImage().scaleHeight( 140 ) ); |
188 | else | 192 | else |
189 | photo.setData( px->convertToImage().scaleWidth( 100 ) ); | 193 | photo.setData( px->convertToImage().scaleWidth( 100 ) ); |
190 | #else //KAB_EMBEDDED | 194 | #else //KAB_EMBEDDED |
191 | //US add teh nullcheck | 195 | //US add teh nullcheck |
192 | if (px->isNull() != true ) | 196 | if (px->isNull() != true ) |
193 | photo.setData( px->convertToImage() ); | 197 | photo.setData( px->convertToImage() ); |
194 | #endif //KAB_EMBEDDED | 198 | #endif //KAB_EMBEDDED |
195 | 199 | ||
196 | photo.setType( "PNG" ); | 200 | photo.setType( "PNG" ); |
197 | } | 201 | } |
198 | } | 202 | } |
199 | 203 | ||
200 | return photo; | 204 | return photo; |
201 | } | 205 | } |
202 | 206 | ||
203 | void ImageWidget::setLogo( const KABC::Picture &logo ) | 207 | void ImageWidget::setLogo( const KABC::Picture &logo ) |
204 | { | 208 | { |
205 | bool blocked = signalsBlocked(); | 209 | bool blocked = signalsBlocked(); |
206 | blockSignals( true ); | 210 | blockSignals( true ); |
207 | 211 | ||
208 | if ( logo.isIntern() ) { | 212 | if ( logo.isIntern() ) { |
209 | //US | 213 | //US |
210 | //US mLogoLabel->setPixmap( logo.data() ); | 214 | //US mLogoLabel->setPixmap( logo.data() ); |
211 | if (logo.data().isNull() != true) | 215 | if (logo.data().isNull() != true) |
212 | { | 216 | { |
213 | QPixmap pm; | 217 | QPixmap pm; |
214 | pm.convertFromImage(logo.data()); | 218 | pm.convertFromImage(logo.data()); |
215 | mLogoLabel->setPixmap( pm ); | 219 | mLogoLabel->setPixmap( pm ); |
216 | } | 220 | } |
217 | mUseLogoUrl->setChecked( false ); | 221 | mUseLogoUrl->setChecked( false ); |
218 | } else { | 222 | } else { |
219 | mLogoUrl->setURL( logo.url() ); | 223 | mLogoUrl->setURL( logo.url() ); |
220 | if ( !logo.url().isEmpty() ) | 224 | if ( !logo.url().isEmpty() ) |
221 | mUseLogoUrl->setChecked( true ); | 225 | mUseLogoUrl->setChecked( true ); |
222 | loadLogo(); | 226 | loadLogo(); |
223 | } | 227 | } |
224 | 228 | ||
225 | blockSignals( blocked ); | 229 | blockSignals( blocked ); |
226 | } | 230 | } |
227 | 231 | ||
228 | KABC::Picture ImageWidget::logo() const | 232 | KABC::Picture ImageWidget::logo() const |
229 | { | 233 | { |
230 | KABC::Picture logo; | 234 | KABC::Picture logo; |
231 | 235 | ||
232 | if ( mUseLogoUrl->isChecked() ) | 236 | if ( mUseLogoUrl->isChecked() ) |
233 | logo.setUrl( mLogoUrl->url() ); | 237 | logo.setUrl( mLogoUrl->url() ); |
234 | else { | 238 | else { |
235 | QPixmap *px = mLogoLabel->pixmap(); | 239 | const QPixmap *px = mLogoLabel->pixmap(); |
236 | if ( px ) { | 240 | if ( px ) { |
237 | #ifndef KAB_EMBEDDED | 241 | #ifndef KAB_EMBEDDED |
238 | if ( px->height() > px->width() ) | 242 | if ( px->height() > px->width() ) |
239 | logo.setData( px->convertToImage().scaleHeight( 140 ) ); | 243 | logo.setData( px->convertToImage().scaleHeight( 140 ) ); |
240 | else | 244 | else |
241 | logo.setData( px->convertToImage().scaleWidth( 100 ) ); | 245 | logo.setData( px->convertToImage().scaleWidth( 100 ) ); |
242 | #else //KAB_EMBEDDED | 246 | #else //KAB_EMBEDDED |
243 | if (px->isNull() != true ) | 247 | if (px->isNull() != true ) |
244 | logo.setData( px->convertToImage() ); | 248 | logo.setData( px->convertToImage() ); |
245 | #endif //KAB_EMBEDDED | 249 | #endif //KAB_EMBEDDED |
246 | 250 | ||
247 | logo.setType( "PNG" ); | 251 | logo.setType( "PNG" ); |
248 | 252 | ||
249 | } | 253 | } |
250 | } | 254 | } |
251 | return logo; | 255 | return logo; |
252 | } | 256 | } |
253 | void ImageWidget::removePhoto() | 257 | void ImageWidget::removePhoto() |
254 | { | 258 | { |
255 | setPhoto(KABC::Picture() ); | 259 | setPhoto(KABC::Picture() ); |
256 | } | 260 | } |
257 | 261 | ||
258 | void ImageWidget::removeLogo() | 262 | void ImageWidget::removeLogo() |
259 | { | 263 | { |
260 | setLogo(KABC::Picture() ); | 264 | setLogo(KABC::Picture() ); |
261 | } | 265 | } |
262 | 266 | ||
263 | void ImageWidget::loadPhoto() | 267 | void ImageWidget::loadPhoto() |
264 | { | 268 | { |
265 | mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); | 269 | mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); |
266 | } | 270 | } |
267 | 271 | ||
268 | void ImageWidget::loadLogo() | 272 | void ImageWidget::loadLogo() |
269 | { | 273 | { |
270 | mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); | 274 | mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); |
271 | } | 275 | } |
272 | 276 | ||
273 | void ImageWidget::updateGUI() | 277 | void ImageWidget::updateGUI() |
274 | { | 278 | { |
275 | KURLRequester *ptr = (KURLRequester*)sender(); | 279 | KURLRequester *ptr = (KURLRequester*)sender(); |
276 | 280 | ||
277 | 281 | ||
278 | if ( ptr == mPhotoUrl ) | 282 | if ( ptr == mPhotoUrl ) |
279 | mUsePhotoUrl->setEnabled( true ); | 283 | mUsePhotoUrl->setEnabled( true ); |
280 | else if ( ptr == mLogoUrl ) | 284 | else if ( ptr == mLogoUrl ) |
281 | mUseLogoUrl->setEnabled( true ); | 285 | mUseLogoUrl->setEnabled( true ); |
282 | } | 286 | } |
283 | 287 | ||
284 | QPixmap ImageWidget::loadPixmap( const QString &url ) | 288 | QPixmap ImageWidget::loadPixmap( const QString &url ) |
285 | { | 289 | { |
286 | 290 | ||
287 | QPixmap pixmap; | 291 | QPixmap pixmap; |
288 | 292 | ||
289 | if ( url.isEmpty() ) | 293 | if ( url.isEmpty() ) |
290 | return pixmap; | 294 | return pixmap; |
291 | pixmap.load( url ); | 295 | pixmap.load( url ); |
292 | return pixmap; | 296 | return pixmap; |
293 | } | 297 | } |
294 | 298 | ||
295 | #ifndef KAB_EMBEDDED | 299 | #ifndef KAB_EMBEDDED_ |
296 | #include "imagewidget.moc" | 300 | #include "moc_imagewidget.cpp" |
297 | #endif //KAB_EMBEDDED | 301 | #endif //KAB_EMBEDDED |