From 33c04477896c52e9cfea2a29facd959f82cbf17a Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 16 Jan 2005 23:41:18 +0000 Subject: several fixes --- (limited to 'kaddressbook/imagewidget.cpp') diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index 48370e3..9ee4eac 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include "imagewidget.h" @@ -52,7 +53,7 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) KDialog::spacingHint() ); QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); - QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, + QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 4, 2, KDialog::spacingHint() ); boxLayout->setRowStretch( 2, 1 ); @@ -63,7 +64,7 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); mPhotoLabel->setScaledContents( true ); mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - boxLayout->addMultiCellWidget( mPhotoLabel, 0, 2, 0, 0 ); + boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 ); mPhotoUrl = new KURLRequester( photoBox ); #ifndef KAB_EMBEDDED @@ -79,17 +80,22 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) mUsePhotoUrl->setEnabled( false ); boxLayout->addWidget( mUsePhotoUrl, 1, 1 ); + QPushButton * pb = new QPushButton( i18n( "Remove" ), photoBox ); + connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) ); + boxLayout->addWidget( pb, 2, 1 ); + boxLayout->addWidget( new QLabel( photoBox ), 3, 1 ); + topLayout->addWidget( photoBox, 0, 0 ); QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); - boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); + boxLayout = new QGridLayout( logoBox->layout(), 4, 2, KDialog::spacingHint() ); boxLayout->setRowStretch( 2, 1 ); mLogoLabel = new QLabel( logoBox ); mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); mLogoLabel->setScaledContents( true ); mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - boxLayout->addMultiCellWidget( mLogoLabel, 0, 2, 0, 0 ); + boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 ); mLogoUrl = new KURLRequester( logoBox ); #ifndef KAB_EMBEDDED @@ -103,6 +109,10 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) mUseLogoUrl->setEnabled( false ); boxLayout->addWidget( mUseLogoUrl, 1, 1 ); + pb = new QPushButton( i18n( "Remove" ), logoBox ); + connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) ); + boxLayout->addWidget( pb, 2, 1 ); + boxLayout->addWidget( new QLabel( logoBox ), 3, 1 ); topLayout->addWidget( logoBox, 1, 0 ); connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), @@ -238,9 +248,17 @@ KABC::Picture ImageWidget::logo() const } } - return logo; } +void ImageWidget::removePhoto() +{ + setPhoto(KABC::Picture() ); +} + +void ImageWidget::removeLogo() +{ + setLogo(KABC::Picture() ); +} void ImageWidget::loadPhoto() { -- cgit v0.9.0.2