summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-06-04 12:58:17 (UTC)
committer zautrix <zautrix>2005-06-04 12:58:17 (UTC)
commit790b8c38e1305b2f5ee4485e59a3ecd01e5b6f75 (patch) (unidiff)
tree7779130ff5f142e1eaf2989e8540cbedc9ea0cb1 /kaddressbook
parenta7939017000e165e711e3f0cffeab46852a9fb2e (diff)
downloadkdepimpi-790b8c38e1305b2f5ee4485e59a3ecd01e5b6f75.zip
kdepimpi-790b8c38e1305b2f5ee4485e59a3ecd01e5b6f75.tar.gz
kdepimpi-790b8c38e1305b2f5ee4485e59a3ecd01e5b6f75.tar.bz2
pic fix
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/imagewidget.cpp21
-rw-r--r--kaddressbook/imagewidget.h2
2 files changed, 4 insertions, 19 deletions
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index d0f52ea..eec5e08 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -1,312 +1,297 @@
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 <qgroupbox.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 46
47#include "imagewidget.h" 47#include "imagewidget.h"
48 48
49ImageWidget::ImageWidget( QWidget *parent, const char *name ) 49ImageWidget::ImageWidget( QWidget *parent, const char *name )
50 : QWidget( parent, name ) 50 : QWidget( parent, name )
51{ 51{
52 QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(), 52 QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(),
53 KDialog::spacingHint() ); 53 KDialog::spacingHint() );
54 54
55 QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); 55 QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this );
56 QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, 56 QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2,
57 KDialog::spacingHint() ); 57 KDialog::spacingHint() );
58 boxLayout->setRowStretch( 2, 1 ); 58 boxLayout->setRowStretch( 2, 1 );
59 59
60 mPhotoLabel = new QLabel( photoBox ); 60 mPhotoLabel = new QLabel( photoBox );
61 int fac = 9; 61 int fac = 9;
62 if ( QApplication::desktop()->width() > 320 ) 62 if ( QApplication::desktop()->width() > 320 )
63 fac = 6; 63 fac = 6;
64 mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); 64 mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac );
65 mPhotoLabel->setScaledContents( true ); 65 mPhotoLabel->setScaledContents( true );
66 mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 66 mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
67 boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 ); 67 boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 );
68 68
69 mPhotoUrl = new KURLRequester( photoBox ); 69 mPhotoUrl = new KURLRequester( photoBox );
70#ifndef KAB_EMBEDDED 70#ifndef KAB_EMBEDDED
71 mPhotoUrl->setFilter( KImageIO::pattern() ); 71 mPhotoUrl->setFilter( KImageIO::pattern() );
72#else //KAB_EMBEDDED 72#else //KAB_EMBEDDED
73//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); 73//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???");
74#endif //KAB_EMBEDDED 74#endif //KAB_EMBEDDED
75 75
76 76
77 boxLayout->addWidget( mPhotoUrl, 0, 1 ); 77 boxLayout->addWidget( mPhotoUrl, 0, 1 );
78 QHBox *hb1 = new QHBox ( photoBox ); 78 QHBox *hb1 = new QHBox ( photoBox );
79 mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 ); 79 mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 );
80 mUsePhotoUrl->setEnabled( false ); 80 mUsePhotoUrl->setEnabled( false );
81 boxLayout->addWidget( hb1, 1, 1 ); 81 boxLayout->addWidget( hb1, 1, 1 );
82 82
83 QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 ); 83 QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 );
84 connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) ); 84 connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) );
85 boxLayout->addWidget( new QLabel( photoBox ), 2, 1 ); 85 boxLayout->addWidget( new QLabel( photoBox ), 2, 1 );
86 86
87 topLayout->addWidget( photoBox, 0, 0 ); 87 topLayout->addWidget( photoBox, 0, 0 );
88 88
89 QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); 89 QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this );
90 boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); 90 boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() );
91 boxLayout->setRowStretch( 2, 1 ); 91 boxLayout->setRowStretch( 2, 1 );
92 92
93 mLogoLabel = new QLabel( logoBox ); 93 mLogoLabel = new QLabel( logoBox );
94 mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); 94 mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac );
95 mLogoLabel->setScaledContents( true ); 95 mLogoLabel->setScaledContents( true );
96 mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 96 mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
97 boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 ); 97 boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 );
98 98
99 mLogoUrl = new KURLRequester( logoBox ); 99 mLogoUrl = new KURLRequester( logoBox );
100#ifndef KAB_EMBEDDED 100#ifndef KAB_EMBEDDED
101 mLogoUrl->setFilter( KImageIO::pattern() ); 101 mLogoUrl->setFilter( KImageIO::pattern() );
102#else //KAB_EMBEDDED 102#else //KAB_EMBEDDED
103//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); 103//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2");
104#endif //KAB_EMBEDDED 104#endif //KAB_EMBEDDED
105 boxLayout->addWidget( mLogoUrl, 0, 1 ); 105 boxLayout->addWidget( mLogoUrl, 0, 1 );
106 106
107 QHBox *hb2 = new QHBox ( logoBox ); 107 QHBox *hb2 = new QHBox ( logoBox );
108 mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 ); 108 mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 );
109 mUseLogoUrl->setEnabled( false ); 109 mUseLogoUrl->setEnabled( false );
110 boxLayout->addWidget( hb2, 1, 1 ); 110 boxLayout->addWidget( hb2, 1, 1 );
111 111
112 pb = new QPushButton( i18n( "Remove" ), hb2 ); 112 pb = new QPushButton( i18n( "Remove" ), hb2 );
113 connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) ); 113 connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) );
114 boxLayout->addWidget( new QLabel( logoBox ), 2, 1 ); 114 boxLayout->addWidget( new QLabel( logoBox ), 2, 1 );
115 topLayout->addWidget( logoBox, 1, 0 ); 115 topLayout->addWidget( logoBox, 1, 0 );
116 116
117 connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), 117 connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ),
118 SIGNAL( changed() ) ); 118 SIGNAL( changed() ) );
119 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), 119 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
120 SLOT( loadPhoto() ) ); 120 SLOT( loadPhoto() ) );
121 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), 121 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
122 SIGNAL( changed() ) ); 122 SIGNAL( changed() ) );
123 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), 123 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
124 SLOT( updateGUI() ) ); 124 SLOT( updateGUI() ) );
125 connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ), 125 connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ),
126 SIGNAL( changed() ) ); 126 SIGNAL( changed() ) );
127 127
128 connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ), 128 connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ),
129 SIGNAL( changed() ) ); 129 SIGNAL( changed() ) );
130 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), 130 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
131 SLOT( loadLogo() ) ); 131 SLOT( loadLogo() ) );
132 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), 132 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
133 SIGNAL( changed() ) ); 133 SIGNAL( changed() ) );
134 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), 134 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
135 SLOT( updateGUI() ) ); 135 SLOT( updateGUI() ) );
136 connect( mUseLogoUrl, SIGNAL( toggled( bool ) ), 136 connect( mUseLogoUrl, SIGNAL( toggled( bool ) ),
137 SIGNAL( changed() ) ); 137 SIGNAL( changed() ) );
138 138
139#ifndef KAB_EMBEDDED 139#ifndef KAB_EMBEDDED
140 KAcceleratorManager::manage( this ); 140 KAcceleratorManager::manage( this );
141#endif //KAB_EMBEDDED 141#endif //KAB_EMBEDDED
142 142
143} 143}
144 144
145ImageWidget::~ImageWidget() 145ImageWidget::~ImageWidget()
146{ 146{
147} 147}
148 148
149void ImageWidget::setPhoto( const KABC::Picture &photo ) 149void ImageWidget::setPhoto( const KABC::Picture &photo )
150{ 150{
151 bool blocked = signalsBlocked(); 151 bool blocked = signalsBlocked();
152 blockSignals( true ); 152 blockSignals( true );
153 153
154 if ( photo.isIntern() ) { 154 if ( photo.isIntern() ) {
155//US 155//US
156//US mPhotoLabel->setPixmap( photo.data() ); 156//US mPhotoLabel->setPixmap( photo.data() );
157 if (photo.data().isNull() != true) 157 if (photo.data().isNull() != true)
158 { 158 {
159 QPixmap pm; 159 QPixmap pm;
160 pm.convertFromImage(photo.data()); 160 pm.convertFromImage(photo.data());
161 161
162 mPhotoLabel->setPixmap( pm ); 162 mPhotoLabel->setPixmap( pm );
163 } 163 }
164 164
165 mUsePhotoUrl->setChecked( false ); 165 mUsePhotoUrl->setChecked( false );
166 } else { 166 } else {
167 mPhotoUrl->setURL( photo.url() ); 167 mPhotoUrl->setURL( photo.url() );
168 if ( !photo.url().isEmpty() ) 168 if ( !photo.url().isEmpty() )
169 mUsePhotoUrl->setChecked( true ); 169 mUsePhotoUrl->setChecked( true );
170 loadPhoto(); 170 loadPhoto();
171 } 171 }
172 172
173 blockSignals( blocked ); 173 blockSignals( blocked );
174} 174}
175 175
176KABC::Picture ImageWidget::photo() const 176KABC::Picture ImageWidget::photo() const
177{ 177{
178 KABC::Picture photo; 178 KABC::Picture photo;
179 179
180 if ( mUsePhotoUrl->isChecked() ) 180 if ( mUsePhotoUrl->isChecked() )
181 photo.setUrl( mPhotoUrl->url() ); 181 photo.setUrl( mPhotoUrl->url() );
182 else { 182 else {
183 QPixmap *px = mPhotoLabel->pixmap(); 183 QPixmap *px = mPhotoLabel->pixmap();
184 if ( px ) { 184 if ( px ) {
185#ifndef KAB_EMBEDDED 185#ifndef KAB_EMBEDDED
186 if ( px->height() > px->width() ) 186 if ( px->height() > px->width() )
187 photo.setData( px->convertToImage().scaleHeight( 140 ) ); 187 photo.setData( px->convertToImage().scaleHeight( 140 ) );
188 else 188 else
189 photo.setData( px->convertToImage().scaleWidth( 100 ) ); 189 photo.setData( px->convertToImage().scaleWidth( 100 ) );
190#else //KAB_EMBEDDED 190#else //KAB_EMBEDDED
191//US add teh nullcheck 191//US add teh nullcheck
192 if (px->isNull() != true ) 192 if (px->isNull() != true )
193 photo.setData( px->convertToImage() ); 193 photo.setData( px->convertToImage() );
194#endif //KAB_EMBEDDED 194#endif //KAB_EMBEDDED
195 195
196 photo.setType( "PNG" ); 196 photo.setType( "PNG" );
197 } 197 }
198 } 198 }
199 199
200 return photo; 200 return photo;
201} 201}
202 202
203void ImageWidget::setLogo( const KABC::Picture &logo ) 203void ImageWidget::setLogo( const KABC::Picture &logo )
204{ 204{
205 bool blocked = signalsBlocked(); 205 bool blocked = signalsBlocked();
206 blockSignals( true ); 206 blockSignals( true );
207 207
208 if ( logo.isIntern() ) { 208 if ( logo.isIntern() ) {
209//US 209//US
210//US mLogoLabel->setPixmap( logo.data() ); 210//US mLogoLabel->setPixmap( logo.data() );
211 if (logo.data().isNull() != true) 211 if (logo.data().isNull() != true)
212 { 212 {
213 QPixmap pm; 213 QPixmap pm;
214 pm.convertFromImage(logo.data()); 214 pm.convertFromImage(logo.data());
215 mLogoLabel->setPixmap( pm ); 215 mLogoLabel->setPixmap( pm );
216 } 216 }
217 mUseLogoUrl->setChecked( false ); 217 mUseLogoUrl->setChecked( false );
218 } else { 218 } else {
219 mLogoUrl->setURL( logo.url() ); 219 mLogoUrl->setURL( logo.url() );
220 if ( !logo.url().isEmpty() ) 220 if ( !logo.url().isEmpty() )
221 mUseLogoUrl->setChecked( true ); 221 mUseLogoUrl->setChecked( true );
222 loadLogo(); 222 loadLogo();
223 } 223 }
224 224
225 blockSignals( blocked ); 225 blockSignals( blocked );
226} 226}
227 227
228KABC::Picture ImageWidget::logo() const 228KABC::Picture ImageWidget::logo() const
229{ 229{
230 KABC::Picture logo; 230 KABC::Picture logo;
231 231
232 if ( mUseLogoUrl->isChecked() ) 232 if ( mUseLogoUrl->isChecked() )
233 logo.setUrl( mLogoUrl->url() ); 233 logo.setUrl( mLogoUrl->url() );
234 else { 234 else {
235 QPixmap *px = mLogoLabel->pixmap(); 235 QPixmap *px = mLogoLabel->pixmap();
236 if ( px ) { 236 if ( px ) {
237#ifndef KAB_EMBEDDED 237#ifndef KAB_EMBEDDED
238 if ( px->height() > px->width() ) 238 if ( px->height() > px->width() )
239 logo.setData( px->convertToImage().scaleHeight( 140 ) ); 239 logo.setData( px->convertToImage().scaleHeight( 140 ) );
240 else 240 else
241 logo.setData( px->convertToImage().scaleWidth( 100 ) ); 241 logo.setData( px->convertToImage().scaleWidth( 100 ) );
242#else //KAB_EMBEDDED 242#else //KAB_EMBEDDED
243 if (px->isNull() != true ) 243 if (px->isNull() != true )
244 logo.setData( px->convertToImage() ); 244 logo.setData( px->convertToImage() );
245#endif //KAB_EMBEDDED 245#endif //KAB_EMBEDDED
246 246
247 logo.setType( "PNG" ); 247 logo.setType( "PNG" );
248 248
249 } 249 }
250 } 250 }
251 return logo; 251 return logo;
252} 252}
253void ImageWidget::removePhoto() 253void ImageWidget::removePhoto()
254{ 254{
255 setPhoto(KABC::Picture() ); 255 setPhoto(KABC::Picture() );
256} 256}
257 257
258void ImageWidget::removeLogo() 258void ImageWidget::removeLogo()
259{ 259{
260 setLogo(KABC::Picture() ); 260 setLogo(KABC::Picture() );
261} 261}
262 262
263void ImageWidget::loadPhoto() 263void ImageWidget::loadPhoto()
264{ 264{
265 mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); 265 mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) );
266} 266}
267 267
268void ImageWidget::loadLogo() 268void ImageWidget::loadLogo()
269{ 269{
270 mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); 270 mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) );
271} 271}
272 272
273void ImageWidget::updateGUI() 273void ImageWidget::updateGUI()
274{ 274{
275 KURLRequester *ptr = (KURLRequester*)sender(); 275 KURLRequester *ptr = (KURLRequester*)sender();
276 276
277 277
278 if ( ptr == mPhotoUrl ) 278 if ( ptr == mPhotoUrl )
279 mUsePhotoUrl->setEnabled( true ); 279 mUsePhotoUrl->setEnabled( true );
280 else if ( ptr == mLogoUrl ) 280 else if ( ptr == mLogoUrl )
281 mUseLogoUrl->setEnabled( true ); 281 mUseLogoUrl->setEnabled( true );
282} 282}
283 283
284QPixmap ImageWidget::loadPixmap( const KURL &url ) 284QPixmap ImageWidget::loadPixmap( const QString &url )
285{ 285{
286 QString tempFile; 286
287 QPixmap pixmap; 287 QPixmap pixmap;
288 288
289 if ( url.isEmpty() ) 289 if ( url.isEmpty() )
290 return pixmap; 290 return pixmap;
291 291 pixmap.load( url );
292 if ( url.isLocalFile() )
293 pixmap = QPixmap( url.path() );
294 else
295 {
296#ifndef KAB_EMBEDDED
297 if ( KIO::NetAccess::download( url, tempFile ) ) {
298 pixmap = QPixmap( tempFile );
299 KIO::NetAccess::removeTempFile( tempFile );
300 }
301#else //KAB_EMBEDDED
302 qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed");
303#endif //KAB_EMBEDDED
304
305 }
306
307 return pixmap; 292 return pixmap;
308} 293}
309 294
310#ifndef KAB_EMBEDDED 295#ifndef KAB_EMBEDDED
311#include "imagewidget.moc" 296#include "imagewidget.moc"
312#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
diff --git a/kaddressbook/imagewidget.h b/kaddressbook/imagewidget.h
index afb9aa7..bbfba58 100644
--- a/kaddressbook/imagewidget.h
+++ b/kaddressbook/imagewidget.h
@@ -1,88 +1,88 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef IMAGEWIDGET_H 24#ifndef IMAGEWIDGET_H
25#define IMAGEWIDGET_H 25#define IMAGEWIDGET_H
26 26
27#include <qwidget.h> 27#include <qwidget.h>
28 28
29#include <kabc/picture.h> 29#include <kabc/picture.h>
30#include <kdialogbase.h> 30#include <kdialogbase.h>
31 31
32class KURL; 32class KURL;
33class KURLRequester; 33class KURLRequester;
34 34
35class QCheckBox; 35class QCheckBox;
36class QLabel; 36class QLabel;
37 37
38class ImageWidget : public QWidget 38class ImageWidget : public QWidget
39{ 39{
40 Q_OBJECT 40 Q_OBJECT
41 41
42 public: 42 public:
43 ImageWidget( QWidget *parent, const char *name = 0 ); 43 ImageWidget( QWidget *parent, const char *name = 0 );
44 ~ImageWidget(); 44 ~ImageWidget();
45 45
46 /** 46 /**
47 Sets the photo object. 47 Sets the photo object.
48 */ 48 */
49 void setPhoto( const KABC::Picture &photo ); 49 void setPhoto( const KABC::Picture &photo );
50 50
51 /** 51 /**
52 Returns a photo object. 52 Returns a photo object.
53 */ 53 */
54 KABC::Picture photo() const; 54 KABC::Picture photo() const;
55 55
56 /** 56 /**
57 Sets the logo object. 57 Sets the logo object.
58 */ 58 */
59 void setLogo( const KABC::Picture &photo ); 59 void setLogo( const KABC::Picture &photo );
60 60
61 /** 61 /**
62 Returns a logo object. 62 Returns a logo object.
63 */ 63 */
64 KABC::Picture logo() const; 64 KABC::Picture logo() const;
65 65
66 signals: 66 signals:
67 void changed(); 67 void changed();
68 68
69 private slots: 69 private slots:
70 void loadPhoto(); 70 void loadPhoto();
71 void loadLogo(); 71 void loadLogo();
72 void removePhoto(); 72 void removePhoto();
73 void removeLogo(); 73 void removeLogo();
74 void updateGUI(); 74 void updateGUI();
75 75
76 private: 76 private:
77 QPixmap loadPixmap( const KURL &url ); 77 QPixmap loadPixmap( const QString &url );
78 78
79 KURLRequester *mPhotoUrl; 79 KURLRequester *mPhotoUrl;
80 KURLRequester *mLogoUrl; 80 KURLRequester *mLogoUrl;
81 81
82 QCheckBox *mUsePhotoUrl; 82 QCheckBox *mUsePhotoUrl;
83 QCheckBox *mUseLogoUrl; 83 QCheckBox *mUseLogoUrl;
84 QLabel *mPhotoLabel; 84 QLabel *mPhotoLabel;
85 QLabel *mLogoLabel; 85 QLabel *mLogoLabel;
86}; 86};
87 87
88#endif 88#endif