summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp12
-rw-r--r--kaddressbook/imagewidget.cpp28
-rw-r--r--kaddressbook/imagewidget.h2
3 files changed, 36 insertions, 6 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index c6993e9..bd32859 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -995,12 +995,22 @@ void AddresseeEditorWidget::load()
995 else 995 else
996 mFormattedNameType = NameEditDialog::CustomName; 996 mFormattedNameType = NameEditDialog::CustomName;
997 } 997 }
998 998
999 mFormattedNameLabel->setText( mAddressee.formattedName() ); 999 mFormattedNameLabel->setText( mAddressee.formattedName() );
1000 1000
1001 mAConfig->setUid( mAddressee.uid() );
1002 if ( mAConfig->automaticNameParsing() ) {
1003 mNameLabel->hide();
1004 mNameEdit->show();
1005 } else {
1006 mNameEdit->hide();
1007 mNameLabel->setText( mNameEdit->text() );
1008 mNameLabel->show();
1009 }
1010
1001 mRoleEdit->setText( mAddressee.role() ); 1011 mRoleEdit->setText( mAddressee.role() );
1002 mOrgEdit->setText( mAddressee.organization() ); 1012 mOrgEdit->setText( mAddressee.organization() );
1003 1013
1004//US mURLEdit->setURL( mAddressee.url().url() ); 1014//US mURLEdit->setURL( mAddressee.url().url() );
1005 mURLEdit->setText( mAddressee.url().prettyURL() ); 1015 mURLEdit->setText( mAddressee.url().prettyURL() );
1006//US?? mURLEdit->home( false ); 1016//US?? mURLEdit->home( false );
@@ -1202,15 +1212,15 @@ void AddresseeEditorWidget::nameTextChanged( const QString &text )
1202 mAddressee.setGivenName( addr.givenName() ); 1212 mAddressee.setGivenName( addr.givenName() );
1203 mAddressee.setAdditionalName( addr.additionalName() ); 1213 mAddressee.setAdditionalName( addr.additionalName() );
1204 mAddressee.setFamilyName( addr.familyName() ); 1214 mAddressee.setFamilyName( addr.familyName() );
1205 mAddressee.setSuffix( addr.suffix() ); 1215 mAddressee.setSuffix( addr.suffix() );
1206 } 1216 }
1207 } 1217 }
1208
1209 nameBoxChanged(); 1218 nameBoxChanged();
1210 1219
1220
1211 emitModified(); 1221 emitModified();
1212} 1222}
1213 1223
1214void AddresseeEditorWidget::nameBoxChanged() 1224void AddresseeEditorWidget::nameBoxChanged()
1215{ 1225{
1216 KABC::Addressee addr; 1226 KABC::Addressee addr;
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index 48370e3..9ee4eac 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -38,35 +38,36 @@
38 38
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qgroupbox.h> 40#include <qgroupbox.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qlayout.h> 42#include <qlayout.h>
43#include <qpixmap.h> 43#include <qpixmap.h>
44#include <qpushbutton.h>
44#include <qapplication.h> 45#include <qapplication.h>
45 46
46#include "imagewidget.h" 47#include "imagewidget.h"
47 48
48ImageWidget::ImageWidget( QWidget *parent, const char *name ) 49ImageWidget::ImageWidget( QWidget *parent, const char *name )
49 : QWidget( parent, name ) 50 : QWidget( parent, name )
50{ 51{
51 QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(), 52 QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(),
52 KDialog::spacingHint() ); 53 KDialog::spacingHint() );
53 54
54 QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); 55 QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this );
55 QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, 56 QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 4, 2,
56 KDialog::spacingHint() ); 57 KDialog::spacingHint() );
57 boxLayout->setRowStretch( 2, 1 ); 58 boxLayout->setRowStretch( 2, 1 );
58 59
59 mPhotoLabel = new QLabel( photoBox ); 60 mPhotoLabel = new QLabel( photoBox );
60 int fac = 9; 61 int fac = 9;
61 if ( QApplication::desktop()->width() > 320 ) 62 if ( QApplication::desktop()->width() > 320 )
62 fac = 6; 63 fac = 6;
63 mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); 64 mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac );
64 mPhotoLabel->setScaledContents( true ); 65 mPhotoLabel->setScaledContents( true );
65 mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 66 mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
66 boxLayout->addMultiCellWidget( mPhotoLabel, 0, 2, 0, 0 ); 67 boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 );
67 68
68 mPhotoUrl = new KURLRequester( photoBox ); 69 mPhotoUrl = new KURLRequester( photoBox );
69#ifndef KAB_EMBEDDED 70#ifndef KAB_EMBEDDED
70 mPhotoUrl->setFilter( KImageIO::pattern() ); 71 mPhotoUrl->setFilter( KImageIO::pattern() );
71#else //KAB_EMBEDDED 72#else //KAB_EMBEDDED
72//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); 73//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???");
@@ -76,23 +77,28 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name )
76 boxLayout->addWidget( mPhotoUrl, 0, 1 ); 77 boxLayout->addWidget( mPhotoUrl, 0, 1 );
77 78
78 mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox ); 79 mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox );
79 mUsePhotoUrl->setEnabled( false ); 80 mUsePhotoUrl->setEnabled( false );
80 boxLayout->addWidget( mUsePhotoUrl, 1, 1 ); 81 boxLayout->addWidget( mUsePhotoUrl, 1, 1 );
81 82
83 QPushButton * pb = new QPushButton( i18n( "Remove" ), photoBox );
84 connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) );
85 boxLayout->addWidget( pb, 2, 1 );
86 boxLayout->addWidget( new QLabel( photoBox ), 3, 1 );
87
82 topLayout->addWidget( photoBox, 0, 0 ); 88 topLayout->addWidget( photoBox, 0, 0 );
83 89
84 QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); 90 QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this );
85 boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); 91 boxLayout = new QGridLayout( logoBox->layout(), 4, 2, KDialog::spacingHint() );
86 boxLayout->setRowStretch( 2, 1 ); 92 boxLayout->setRowStretch( 2, 1 );
87 93
88 mLogoLabel = new QLabel( logoBox ); 94 mLogoLabel = new QLabel( logoBox );
89 mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); 95 mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac );
90 mLogoLabel->setScaledContents( true ); 96 mLogoLabel->setScaledContents( true );
91 mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 97 mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
92 boxLayout->addMultiCellWidget( mLogoLabel, 0, 2, 0, 0 ); 98 boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 );
93 99
94 mLogoUrl = new KURLRequester( logoBox ); 100 mLogoUrl = new KURLRequester( logoBox );
95#ifndef KAB_EMBEDDED 101#ifndef KAB_EMBEDDED
96 mLogoUrl->setFilter( KImageIO::pattern() ); 102 mLogoUrl->setFilter( KImageIO::pattern() );
97#else //KAB_EMBEDDED 103#else //KAB_EMBEDDED
98//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); 104//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2");
@@ -100,12 +106,16 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name )
100 boxLayout->addWidget( mLogoUrl, 0, 1 ); 106 boxLayout->addWidget( mLogoUrl, 0, 1 );
101 107
102 mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox ); 108 mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox );
103 mUseLogoUrl->setEnabled( false ); 109 mUseLogoUrl->setEnabled( false );
104 boxLayout->addWidget( mUseLogoUrl, 1, 1 ); 110 boxLayout->addWidget( mUseLogoUrl, 1, 1 );
105 111
112 pb = new QPushButton( i18n( "Remove" ), logoBox );
113 connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) );
114 boxLayout->addWidget( pb, 2, 1 );
115 boxLayout->addWidget( new QLabel( logoBox ), 3, 1 );
106 topLayout->addWidget( logoBox, 1, 0 ); 116 topLayout->addWidget( logoBox, 1, 0 );
107 117
108 connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), 118 connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ),
109 SIGNAL( changed() ) ); 119 SIGNAL( changed() ) );
110 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), 120 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
111 SLOT( loadPhoto() ) ); 121 SLOT( loadPhoto() ) );
@@ -235,15 +245,23 @@ KABC::Picture ImageWidget::logo() const
235#endif //KAB_EMBEDDED 245#endif //KAB_EMBEDDED
236 246
237 logo.setType( "PNG" ); 247 logo.setType( "PNG" );
238 248
239 } 249 }
240 } 250 }
241
242 return logo; 251 return logo;
243} 252}
253void ImageWidget::removePhoto()
254{
255 setPhoto(KABC::Picture() );
256}
257
258void ImageWidget::removeLogo()
259{
260 setLogo(KABC::Picture() );
261}
244 262
245void ImageWidget::loadPhoto() 263void ImageWidget::loadPhoto()
246{ 264{
247 mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); 265 mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) );
248} 266}
249 267
diff --git a/kaddressbook/imagewidget.h b/kaddressbook/imagewidget.h
index b3ca0bd..afb9aa7 100644
--- a/kaddressbook/imagewidget.h
+++ b/kaddressbook/imagewidget.h
@@ -66,12 +66,14 @@ class ImageWidget : public QWidget
66 signals: 66 signals:
67 void changed(); 67 void changed();
68 68
69 private slots: 69 private slots:
70 void loadPhoto(); 70 void loadPhoto();
71 void loadLogo(); 71 void loadLogo();
72 void removePhoto();
73 void removeLogo();
72 void updateGUI(); 74 void updateGUI();
73 75
74 private: 76 private:
75 QPixmap loadPixmap( const KURL &url ); 77 QPixmap loadPixmap( const KURL &url );
76 78
77 KURLRequester *mPhotoUrl; 79 KURLRequester *mPhotoUrl;