27 #include <klineedit.h>
28 #include <tdelocale.h>
31 #include "simpleaddresseeeditor.h"
33 SimpleAddresseeEditor::SimpleAddresseeEditor( TQWidget *parent,
const char *name )
34 : AddresseeEditorBase( parent, name ),
36 mBlockModified( false )
38 kdDebug(5720) <<
"SimpleAddresseeEditor()" << endl;
43 SimpleAddresseeEditor::~SimpleAddresseeEditor()
45 kdDebug(5720) <<
"~SimpleAddresseeEditor()" << endl;
48 void SimpleAddresseeEditor::setAddressee(
const TDEABC::Addressee &addr )
55 const TDEABC::Addressee &SimpleAddresseeEditor::addressee()
60 void SimpleAddresseeEditor::setInitialFocus()
62 mNameEdit->setFocus();
65 void SimpleAddresseeEditor::initGui()
67 TQGridLayout *topLayout =
new TQGridLayout(
this, 2, 2, KDialog::marginHint(),
68 KDialog::spacingHint() );
70 TQLabel *label =
new TQLabel( i18n(
"Name:" ),
this );
71 topLayout->addWidget( label, 0, 0 );
73 mNameEdit =
new KLineEdit(
this );
74 topLayout->addWidget( mNameEdit, 0, 1 );
75 connect( mNameEdit, TQ_SIGNAL( textChanged(
const TQString & ) ),
76 TQ_SLOT( emitModified() ) );
78 label =
new TQLabel( i18n(
"Email:" ),
this );
79 topLayout->addWidget( label, 1, 0 );
81 mEmailEdit =
new KLineEdit(
this );
82 topLayout->addWidget( mEmailEdit, 1, 1 );
83 connect( mEmailEdit, TQ_SIGNAL( textChanged(
const TQString & ) ),
84 TQ_SLOT( emitModified() ) );
87 void SimpleAddresseeEditor::load()
89 kdDebug(5720) <<
"SimpleAddresseeEditor::load()" << endl;
91 kdDebug(5720) <<
"ASSEMBLED NAME: " << mAddressee.assembledName() << endl;
92 kdDebug(5720) <<
"EMAIL NAME: " << mAddressee.preferredEmail() << endl;
94 mBlockModified =
true;
96 mNameEdit->setText( mAddressee.assembledName() );
97 mEmailEdit->setText( mAddressee.preferredEmail() );
99 mBlockModified =
false;
104 void SimpleAddresseeEditor::save()
106 if ( !mDirty )
return;
108 mAddressee.setNameFromString( mNameEdit->text() );
109 mAddressee.insertEmail( mEmailEdit->text(),
true );
114 bool SimpleAddresseeEditor::dirty()
119 void SimpleAddresseeEditor::emitModified()
121 if ( mBlockModified )
129 #include "simpleaddresseeeditor.moc"