Diffstat (limited to 'kaddressbook/imagewidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/imagewidget.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index 48370e3..9ee4eac 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp @@ -42,4 +42,5 @@ #include <qlayout.h> #include <qpixmap.h> +#include <qpushbutton.h> #include <qapplication.h> @@ -53,5 +54,5 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) 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 ); @@ -64,5 +65,5 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) 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 ); @@ -80,8 +81,13 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) 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 ); @@ -90,5 +96,5 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) 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 ); @@ -104,4 +110,8 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) 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 ); @@ -239,7 +249,15 @@ KABC::Picture ImageWidget::logo() const } } - return logo; } +void ImageWidget::removePhoto() +{ + setPhoto(KABC::Picture() ); +} + +void ImageWidget::removeLogo() +{ + setLogo(KABC::Picture() ); +} void ImageWidget::loadPhoto() |