2
This file is part of KContactManager.
4
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#include "nameeditwidget.h"
23
#include <QtCore/QString>
24
#include <QtGui/QHBoxLayout>
26
#include <kabc/addressee.h>
28
#include <klineedit.h>
30
NameEditWidget::NameEditWidget( QWidget *parent )
33
QHBoxLayout *layout = new QHBoxLayout( this );
34
layout->setMargin( 0 );
35
layout->setSpacing( KDialog::spacingHint() );
37
mNameEdit = new KLineEdit;
38
layout->addWidget( mNameEdit );
40
connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( textChanged( const QString& ) ) );
43
NameEditWidget::~NameEditWidget()
47
void NameEditWidget::setReadOnly( bool readOnly )
49
mNameEdit->setReadOnly( readOnly );
52
void NameEditWidget::loadContact( const KABC::Addressee &contact )
54
mNameEdit->setText( contact.assembledName() );
57
void NameEditWidget::storeContact( KABC::Addressee &contact ) const
59
contact.setNameFromString( mNameEdit->text() );
62
void NameEditWidget::textChanged( const QString &text )
64
KABC::Addressee contact;
65
contact.setNameFromString( text );
67
emit nameChanged( contact );
70
#include "nameeditwidget.moc"