-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 @@ -43,2 +43,3 @@ #include <qpixmap.h> +#include <qpushbutton.h> #include <qapplication.h> @@ -54,3 +55,3 @@ 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() ); @@ -65,3 +66,3 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - boxLayout->addMultiCellWidget( mPhotoLabel, 0, 2, 0, 0 ); + boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 ); @@ -81,2 +82,7 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) + 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 ); @@ -84,3 +90,3 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) 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 ); @@ -91,3 +97,3 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - boxLayout->addMultiCellWidget( mLogoLabel, 0, 2, 0, 0 ); + boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 ); @@ -105,2 +111,6 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) + 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 ); @@ -240,5 +250,13 @@ KABC::Picture ImageWidget::logo() const } - return logo; } +void ImageWidget::removePhoto() +{ + setPhoto(KABC::Picture() ); +} + +void ImageWidget::removeLogo() +{ + setLogo(KABC::Picture() ); +} |