summaryrefslogtreecommitdiffabout
path: root/kaddressbook/imagewidget.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/imagewidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/imagewidget.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index 9ee4eac..1e9743c 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -8,156 +8,155 @@
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kabc/picture.h>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#include <kio/netaccess.h>
#include <kimageio.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kurlrequester.h>
#include <kurl.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qapplication.h>
#include "imagewidget.h"
ImageWidget::ImageWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(),
KDialog::spacingHint() );
QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this );
- QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 4, 2,
+ QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2,
KDialog::spacingHint() );
boxLayout->setRowStretch( 2, 1 );
mPhotoLabel = new QLabel( photoBox );
int fac = 9;
if ( QApplication::desktop()->width() > 320 )
fac = 6;
mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac );
mPhotoLabel->setScaledContents( true );
mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 );
mPhotoUrl = new KURLRequester( photoBox );
#ifndef KAB_EMBEDDED
mPhotoUrl->setFilter( KImageIO::pattern() );
#else //KAB_EMBEDDED
//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???");
#endif //KAB_EMBEDDED
boxLayout->addWidget( mPhotoUrl, 0, 1 );
-
- mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox );
+ QHBox *hb1 = new QHBox ( photoBox );
+ mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 );
mUsePhotoUrl->setEnabled( false );
- boxLayout->addWidget( mUsePhotoUrl, 1, 1 );
+ boxLayout->addWidget( hb1, 1, 1 );
- QPushButton * pb = new QPushButton( i18n( "Remove" ), photoBox );
+ QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 );
connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) );
- boxLayout->addWidget( pb, 2, 1 );
- boxLayout->addWidget( new QLabel( photoBox ), 3, 1 );
+ boxLayout->addWidget( new QLabel( photoBox ), 2, 1 );
topLayout->addWidget( photoBox, 0, 0 );
QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this );
- boxLayout = new QGridLayout( logoBox->layout(), 4, 2, KDialog::spacingHint() );
+ boxLayout = new QGridLayout( logoBox->layout(), 3, 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, 3, 0, 0 );
mLogoUrl = new KURLRequester( logoBox );
#ifndef KAB_EMBEDDED
mLogoUrl->setFilter( KImageIO::pattern() );
#else //KAB_EMBEDDED
//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2");
#endif //KAB_EMBEDDED
boxLayout->addWidget( mLogoUrl, 0, 1 );
- mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox );
+ QHBox *hb2 = new QHBox ( logoBox );
+ mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 );
mUseLogoUrl->setEnabled( false );
- boxLayout->addWidget( mUseLogoUrl, 1, 1 );
+ boxLayout->addWidget( hb2, 1, 1 );
- pb = new QPushButton( i18n( "Remove" ), logoBox );
+ pb = new QPushButton( i18n( "Remove" ), hb2 );
connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) );
- boxLayout->addWidget( pb, 2, 1 );
- boxLayout->addWidget( new QLabel( logoBox ), 3, 1 );
+ boxLayout->addWidget( new QLabel( logoBox ), 2, 1 );
topLayout->addWidget( logoBox, 1, 0 );
connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ),
SIGNAL( changed() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( loadPhoto() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SIGNAL( changed() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( updateGUI() ) );
connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( loadLogo() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( updateGUI() ) );
connect( mUseLogoUrl, SIGNAL( toggled( bool ) ),
SIGNAL( changed() ) );
#ifndef KAB_EMBEDDED
KAcceleratorManager::manage( this );
#endif //KAB_EMBEDDED
}
ImageWidget::~ImageWidget()
{
}
void ImageWidget::setPhoto( const KABC::Picture &photo )
{
bool blocked = signalsBlocked();
blockSignals( true );
if ( photo.isIntern() ) {
//US
//US mPhotoLabel->setPixmap( photo.data() );
if (photo.data().isNull() != true)
{
QPixmap pm;
pm.convertFromImage(photo.data());
mPhotoLabel->setPixmap( pm );