summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-16 23:41:18 (UTC)
committer zautrix <zautrix>2005-01-16 23:41:18 (UTC)
commit33c04477896c52e9cfea2a29facd959f82cbf17a (patch) (side-by-side diff)
treed7e5a882604b3bfb64087738dd61d702d2d96a60
parent507b362d42d5eed6277ad17422b6ba61acca636e (diff)
downloadkdepimpi-33c04477896c52e9cfea2a29facd959f82cbf17a.zip
kdepimpi-33c04477896c52e9cfea2a29facd959f82cbf17a.tar.gz
kdepimpi-33c04477896c52e9cfea2a29facd959f82cbf17a.tar.bz2
several fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt3
-rw-r--r--kabc/addresseedialog.cpp2
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp12
-rw-r--r--kaddressbook/imagewidget.cpp28
-rw-r--r--kaddressbook/imagewidget.h2
5 files changed, 40 insertions, 7 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index d8f8323..e53127c 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,76 +1,79 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 1.9.18 ************
FYI: The VERSION 1.9.17 was a testing release only.
Please read the changelog of VERSION 1.9.17 as well.
Cleaned up the syncing config dialog.
Added sync config options for date range for events.
Added sync config options for filters on incoming data.
Added sync config options for filters on outgoing data.
Please read the updated SyncHowTo about the new filter settings.
These filter settings make it now possible to sync with shared
calendars without writing back private or confidential data
(via the outgoing filters).
To sync only with particular parts of a shared calendar,
the incoming filter settings can be used.
An example can be found in the SyncHowTo.
KO/Pi:
The timeedit input has a pulldown list for times.
If opened, this pulldown list should now has the right time highlighted.
Added the possibility to exclude events/todos/journals in a filter.
You should exclude journals, if you do not want them to sync with a public calendar.
KA/Pi:
Added the possibility to in/exclude public/private/confidential contacts to a filter.
If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ...
+Added printing of card view and details view on desktop.
+Printing of list view is not working...
+Added button for removing pictures in contact editor.
********** VERSION 1.9.17 ************
KO/Pi:
Fixed that tooltips were not updated after moving an item in agenda view.
Fixed a bug in sorting start date for recurring events in list view.
Changed the left button in todo viewer from "Agenda" to "Set completed".
This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View.
Added more info in the todo viewer: Startdate, parent/sub todos.
KA/Pi:
All fields search does now actually search all the (possible) fields,
not only those listed in the contact list.
Made is possible to inline a picture in a vcard on the Z.
This was only possible on the desktop, now is it possible on the Z as well.
Fixed of missing save settings after filter configuration.
Made saving of addressbook much faster.
Fixed extension widget layout problem.
Fixed saving of default formatted name settings.
Fixed formatted name handling in edit dialog.
Added an option for changing formatted names of many contacts
(menu: File - Change - Set formatted name).
QWhatsThis was not working on the Z ( only black rectangle was shown).
This is Fixed.
KDE-Sync:
Now readonly KDE resources are synced as well.
(They are not changed in KDE itself, of course).
********** VERSION 1.9.16 ************
KO/Pi:
Fixed search dialog size on Z 6000 (480x640 display).
Added setting to hide/show time in agenda items.
Added setting to hide not running todos in todo view.
Added columns for start date/time in todo view.
Replaced the solid half-hour lines in agenda view by dot lines.
Added possibility of printing the What's Next View on the desktop
(i.e. Windows and Linux).
Fixed a crash in KO/Pi when starting KO/Pi with What's Next view.
Added tooltips in month view.(Tooltips only available on desktop)
Fixed a strange problem in KO/Pi alarm applet.
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index ae67968..9ea9d04 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -1,92 +1,92 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qlayout.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qapplication.h>
#include <qregexp.h>
#include <klocale.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include "stdaddressbook.h"
#include "addresseedialog.h"
//#include "addresseedialog.moc"
using namespace KABC;
AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) :
QListViewItem( parent ),
mAddressee( addressee )
{
QString name = addressee.familyName()+", "+ addressee.givenName();
if ( name.length() == 2 )
- name = addressee.realName();
+ name = addressee.organization();
setText( Name,name);
setText( Email, addressee.preferredEmail() );
}
QString AddresseeItem::key( int column, bool ) const
{
if (column == Email) {
QString value = text(Email);
int val = value.findRev("@");
return value.mid( val) + value.left( val );
}
return text(column).lower();
}
AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
KDialogBase( KDialogBase::Plain, i18n("Select Addressee"),
Ok|Cancel, Ok, parent ), mMultiple( multiple )
{
QWidget *topWidget = plainPage();
QBoxLayout *topLayout = new QHBoxLayout( topWidget );
QBoxLayout *listLayout = new QVBoxLayout;
topLayout->addLayout( listLayout );
mAddresseeList = new KListView( topWidget );
mAddresseeList->addColumn( i18n("Name") );
mAddresseeList->addColumn( i18n("Email") );
mAddresseeList->setAllColumnsShowFocus( true );
mAddresseeList->setFullWidth( true );
listLayout->addWidget( mAddresseeList );
connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ),
SLOT( slotOk() ) );
mAddresseeEdit = new QLineEdit( topWidget );
connect( mAddresseeEdit, SIGNAL( returnPressed() ),
SLOT( loadAddressBook() ) );
mAddresseeEdit->setFocus();
listLayout->addWidget( mAddresseeEdit );
if ( mMultiple ) {
QBoxLayout *selectedLayout = new QVBoxLayout;
topLayout->addLayout( selectedLayout );
topLayout->setSpacing( spacingHint() );
QGroupBox *selectedGroup = new QGroupBox( 1, Horizontal, i18n("Selected"),
topWidget );
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index c6993e9..bd32859 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -953,96 +953,106 @@ void AddresseeEditorWidget::setupTab3_1()
//////////////////////////////////////
// Images
mImageWidget = new ImageWidget( tab3 );
mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
/*US
//////////////////////////////////////
// Keys
mKeyWidget = new KeyWidget( tab3 );
mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
*/
mTabWidget->addTab( tab3, i18n( "&Images" ) );
}
void AddresseeEditorWidget::load()
{
// Block signals in case anything tries to emit modified
// CS: This doesn't seem to work.
bool block = signalsBlocked();
blockSignals( true );
mBlockSignals = true; // used for internal signal blocking
mNameEdit->setText( mAddressee.assembledName() );
if ( mAddressee.formattedName().isEmpty() ) {
//US KConfig config( "kaddressbookrc" );
KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
} else {;
if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
mFormattedNameType = NameEditDialog::SimpleName;
else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
mFormattedNameType = NameEditDialog::FullName;
else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
mFormattedNameType = NameEditDialog::ReverseName;
else
mFormattedNameType = NameEditDialog::CustomName;
}
mFormattedNameLabel->setText( mAddressee.formattedName() );
+ mAConfig->setUid( mAddressee.uid() );
+ if ( mAConfig->automaticNameParsing() ) {
+ mNameLabel->hide();
+ mNameEdit->show();
+ } else {
+ mNameEdit->hide();
+ mNameLabel->setText( mNameEdit->text() );
+ mNameLabel->show();
+ }
+
mRoleEdit->setText( mAddressee.role() );
mOrgEdit->setText( mAddressee.organization() );
//US mURLEdit->setURL( mAddressee.url().url() );
mURLEdit->setText( mAddressee.url().prettyURL() );
//US?? mURLEdit->home( false );
// mNoteEdit->setText( mAddressee.note() );
mNoteEdit->setText( mAddressee.note() );
mEmailWidget->setEmails( mAddressee.emails() );
mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
mBirthdayPicker->setDate( mAddressee.birthday().date() );
//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
"%Y-%m-%d"); // = Qt::ISODate
mAnniversaryPicker->setDate( dt );
mNicknameEdit->setText( mAddressee.nickName() );
mCategoryEdit->setText( mAddressee.categories().join( "," ) );
mGeoWidget->setGeo( mAddressee.geo() );
mImageWidget->setPhoto( mAddressee.photo() );
mImageWidget->setLogo( mAddressee.logo() );
mKeyWidget->setKeys( mAddressee.keys() );
mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
#ifndef KAB_EMBEDDED
mSoundWidget->setSound( mAddressee.sound() );
#else //KAB_EMBEDDED
//US qDebug("AddresseeEditorWidget::load has to be changed 2");
#endif //KAB_EMBEDDED
// Load customs
mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
if ( gen == "female" )
mGenderBox->setCurrentItem ( 1 );
else if ( gen == "male" )
@@ -1160,99 +1170,99 @@ void AddresseeEditorWidget::save()
bool AddresseeEditorWidget::dirty()
{
if ( ! mDirty ) {
if ( mBirthdayPicker->inputIsValid() ) {
QDate da = mBirthdayPicker->date();
if ( !(da == mAddressee.birthday().date()))
mDirty = true;
}
else {
mBirthdayPicker->clear();
}
if ( mAnniversaryPicker->inputIsValid() ) {
QDate da = mAnniversaryPicker->date();
if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
"%Y-%m-%d"))
mDirty = true;
}
else {
mAnniversaryPicker->clear();
}
}
return mDirty;
}
void AddresseeEditorWidget::nameTextChanged( const QString &text )
{
if ( mBlockSignals )
return;
// use the addressee class to parse the name for us
mAConfig->setUid( mAddressee.uid() );
if ( mAConfig->automaticNameParsing() ) {
if ( !mAddressee.formattedName().isEmpty() ) {
QString fn = mAddressee.formattedName();
mAddressee.setNameFromString( text );
mAddressee.setFormattedName( fn );
} else {
// use extra addressee to avoid a formatted name assignment
Addressee addr;
addr.setNameFromString( text );
mAddressee.setPrefix( addr.prefix() );
mAddressee.setGivenName( addr.givenName() );
mAddressee.setAdditionalName( addr.additionalName() );
mAddressee.setFamilyName( addr.familyName() );
mAddressee.setSuffix( addr.suffix() );
}
}
-
nameBoxChanged();
+
emitModified();
}
void AddresseeEditorWidget::nameBoxChanged()
{
KABC::Addressee addr;
mAConfig->setUid( mAddressee.uid() );
if ( mAConfig->automaticNameParsing() ) {
addr.setNameFromString( mNameEdit->text() );
mNameLabel->hide();
mNameEdit->show();
} else {
addr = mAddressee;
mNameEdit->hide();
mNameLabel->setText( mNameEdit->text() );
mNameLabel->show();
}
if ( mFormattedNameType != NameEditDialog::CustomName ) {
mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
}
}
void AddresseeEditorWidget::nameButtonClicked()
{
// show the name dialog.
NameEditDialog dialog( mAddressee, mFormattedNameType, this );
if ( KApplication::execDialog( &dialog) ) {
if ( dialog.changed() ) {
mAddressee.setFamilyName( dialog.familyName() );
mAddressee.setGivenName( dialog.givenName() );
mAddressee.setPrefix( dialog.prefix() );
mAddressee.setSuffix( dialog.suffix() );
mAddressee.setAdditionalName( dialog.additionalName() );
mFormattedNameType = dialog.formattedNameType();
if ( mFormattedNameType == NameEditDialog::CustomName ) {
mFormattedNameLabel->setText( dialog.customFormattedName() );
mAddressee.setFormattedName( dialog.customFormattedName() );
}
// Update the name edit.
bool block = mNameEdit->signalsBlocked();
mNameEdit->blockSignals( true );
mNameEdit->setText( mAddressee.assembledName() );
mNameEdit->blockSignals( block );
// Update the combo box.
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index 48370e3..9ee4eac 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -1,153 +1,163 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(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(), 3, 2,
+ QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 4, 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, 2, 0, 0 );
+ 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 );
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
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 );
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& ) ),
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 );
@@ -193,99 +203,107 @@ KABC::Picture ImageWidget::photo() const
void ImageWidget::setLogo( const KABC::Picture &logo )
{
bool blocked = signalsBlocked();
blockSignals( true );
if ( logo.isIntern() ) {
//US
//US mLogoLabel->setPixmap( logo.data() );
if (logo.data().isNull() != true)
{
QPixmap pm;
pm.convertFromImage(logo.data());
mLogoLabel->setPixmap( pm );
}
mUseLogoUrl->setChecked( false );
} else {
mLogoUrl->setURL( logo.url() );
if ( !logo.url().isEmpty() )
mUseLogoUrl->setChecked( true );
loadLogo();
}
blockSignals( blocked );
}
KABC::Picture ImageWidget::logo() const
{
KABC::Picture logo;
if ( mUseLogoUrl->isChecked() )
logo.setUrl( mLogoUrl->url() );
else {
QPixmap *px = mLogoLabel->pixmap();
if ( px ) {
#ifndef KAB_EMBEDDED
if ( px->height() > px->width() )
logo.setData( px->convertToImage().scaleHeight( 140 ) );
else
logo.setData( px->convertToImage().scaleWidth( 100 ) );
#else //KAB_EMBEDDED
logo.setData( px->convertToImage() );
#endif //KAB_EMBEDDED
logo.setType( "PNG" );
}
}
-
return logo;
}
+void ImageWidget::removePhoto()
+{
+ setPhoto(KABC::Picture() );
+}
+
+void ImageWidget::removeLogo()
+{
+ setLogo(KABC::Picture() );
+}
void ImageWidget::loadPhoto()
{
mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) );
}
void ImageWidget::loadLogo()
{
mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) );
}
void ImageWidget::updateGUI()
{
KURLRequester *ptr = (KURLRequester*)sender();
if ( ptr == mPhotoUrl )
mUsePhotoUrl->setEnabled( true );
else if ( ptr == mLogoUrl )
mUseLogoUrl->setEnabled( true );
}
QPixmap ImageWidget::loadPixmap( const KURL &url )
{
QString tempFile;
QPixmap pixmap;
if ( url.isEmpty() )
return pixmap;
if ( url.isLocalFile() )
pixmap = QPixmap( url.path() );
else
{
#ifndef KAB_EMBEDDED
if ( KIO::NetAccess::download( url, tempFile ) ) {
pixmap = QPixmap( tempFile );
KIO::NetAccess::removeTempFile( tempFile );
}
#else //KAB_EMBEDDED
qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed");
#endif //KAB_EMBEDDED
}
return pixmap;
}
diff --git a/kaddressbook/imagewidget.h b/kaddressbook/imagewidget.h
index b3ca0bd..afb9aa7 100644
--- a/kaddressbook/imagewidget.h
+++ b/kaddressbook/imagewidget.h
@@ -24,63 +24,65 @@
#ifndef IMAGEWIDGET_H
#define IMAGEWIDGET_H
#include <qwidget.h>
#include <kabc/picture.h>
#include <kdialogbase.h>
class KURL;
class KURLRequester;
class QCheckBox;
class QLabel;
class ImageWidget : public QWidget
{
Q_OBJECT
public:
ImageWidget( QWidget *parent, const char *name = 0 );
~ImageWidget();
/**
Sets the photo object.
*/
void setPhoto( const KABC::Picture &photo );
/**
Returns a photo object.
*/
KABC::Picture photo() const;
/**
Sets the logo object.
*/
void setLogo( const KABC::Picture &photo );
/**
Returns a logo object.
*/
KABC::Picture logo() const;
signals:
void changed();
private slots:
void loadPhoto();
void loadLogo();
+ void removePhoto();
+ void removeLogo();
void updateGUI();
private:
QPixmap loadPixmap( const KURL &url );
KURLRequester *mPhotoUrl;
KURLRequester *mLogoUrl;
QCheckBox *mUsePhotoUrl;
QCheckBox *mUseLogoUrl;
QLabel *mPhotoLabel;
QLabel *mLogoLabel;
};
#endif