31 #include <KPIMIdentities/Identity>
32 #include <KPIMIdentities/IdentityManager>
36 using namespace KPIMIdentities;
42 mConfigurationContainer( settingsContainer )
45 if ( dynamic_cast< Settings * >( mConfigurationContainer ) ) {
47 mUseSpecificIdentity->setChecked(
true );
48 mUseSpecificIdentity->hide();
51 connect( mIdentitySelector, SIGNAL(identityChanged(uint)),
52 this, SLOT(identitySelected(uint)) );
54 connect( mUseSpecificIdentity, SIGNAL(clicked(
bool)),
55 this, SLOT(useSpecificIdentity(
bool)) );
57 connect( mModifyIdentitiesButton, SIGNAL(clicked(
bool)),
58 this, SLOT(modifyIdentities()) );
68 const Identity &identity = mConfigurationContainer->
identity();
69 if ( identity.isNull() ) {
70 mUseSpecificIdentity->setChecked(
false );
71 useSpecificIdentity(
false );
73 mIdentitySelector->setCurrentIdentity( identity.uoid() );
74 mUseSpecificIdentity->setChecked(
true );
75 useSpecificIdentity(
true );
81 if ( mUseSpecificIdentity->isChecked() ) {
83 uint uoid = mIdentitySelector->currentIdentity();
84 mConfigurationContainer->
setIdentity( im->identityForUoid( uoid ) );
86 mConfigurationContainer->
setIdentity( Identity::null() );
93 void IdentityWidget::identitySelected( uint uoid )
96 const Identity &identity = im->identityForUoid( uoid );
97 loadFromIdentity( identity );
99 emit changed( ( uoid != mConfigurationContainer->
identity().uoid() ) );
102 void IdentityWidget::useSpecificIdentity(
bool useSpecific )
104 mIdentitySelector->setEnabled( useSpecific );
105 mModifyIdentitiesButton->setEnabled( useSpecific );
107 identitySelected( mIdentitySelector->currentIdentity() );
109 loadFromIdentity( Identity::null() );
110 emit changed( !mConfigurationContainer->
identity().isNull() );
114 void IdentityWidget::loadFromIdentity(
const Identity &identity )
116 mName->setText( identity.fullName() );
117 mOrganisation->setText( identity.organization() );
118 mEmail->setText( identity.primaryEmailAddress() );
119 mReplyto->setText( identity.replyToAddr() );
120 mMailcopiesto->setText( identity.property(
"Mail-Copies-To" ).toString() );
123 void IdentityWidget::modifyIdentities()
125 IdentityEditionDialog dlg( mIdentitySelector->currentIdentity(), this );
131 identitySelected( mIdentitySelector->currentIdentity() );
136 #include "identity_widget.moc"
static KNGlobals * self()
Return the KNGlobals instance.
Interface for object (global settings, account and group) that contains common settings (like identit...
KPIMIdentities::IdentityManager * identityManager()
Returns the identity manager.
virtual const KPIMIdentities::Identity & identity() const =0
Returns the identity configured for this container.
virtual void setIdentity(const KPIMIdentities::Identity &identity)=0
Sets the identity for this group.
virtual void writeConfig()=0
Save the configuration to disk.