Diffstat (limited to 'kaddressbook/imagewidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/imagewidget.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index d0f52ea..eec5e08 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp @@ -220,93 +220,78 @@ void ImageWidget::setLogo( const KABC::Picture &logo ) if ( !logo.url().isEmpty() ) mUseLogoUrl->setChecked( true ); loadLogo(); } blockSignals( blocked ); } KABC::Picture ImageWidget::logo() const { KABC::Picture logo; if ( mUseLogoUrl->isChecked() ) logo.setUrl( mLogoUrl->url() ); else { QPixmap *px = mLogoLabel->pixmap(); if ( px ) { #ifndef KAB_EMBEDDED if ( px->height() > px->width() ) logo.setData( px->convertToImage().scaleHeight( 140 ) ); else logo.setData( px->convertToImage().scaleWidth( 100 ) ); #else //KAB_EMBEDDED if (px->isNull() != true ) logo.setData( px->convertToImage() ); #endif //KAB_EMBEDDED logo.setType( "PNG" ); } } return logo; } void ImageWidget::removePhoto() { setPhoto(KABC::Picture() ); } void ImageWidget::removeLogo() { setLogo(KABC::Picture() ); } void ImageWidget::loadPhoto() { mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); } void ImageWidget::loadLogo() { mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); } void ImageWidget::updateGUI() { KURLRequester *ptr = (KURLRequester*)sender(); if ( ptr == mPhotoUrl ) mUsePhotoUrl->setEnabled( true ); else if ( ptr == mLogoUrl ) mUseLogoUrl->setEnabled( true ); } -QPixmap ImageWidget::loadPixmap( const KURL &url ) +QPixmap ImageWidget::loadPixmap( const QString &url ) { - QString tempFile; + QPixmap pixmap; if ( url.isEmpty() ) return pixmap; - - if ( url.isLocalFile() ) - pixmap = QPixmap( url.path() ); - else - { -#ifndef KAB_EMBEDDED - if ( KIO::NetAccess::download( url, tempFile ) ) { - pixmap = QPixmap( tempFile ); - KIO::NetAccess::removeTempFile( tempFile ); - } -#else //KAB_EMBEDDED - qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed"); -#endif //KAB_EMBEDDED - - } - + pixmap.load( url ); return pixmap; } #ifndef KAB_EMBEDDED #include "imagewidget.moc" #endif //KAB_EMBEDDED |