36 #include "identitydialog.h"
39 #include "signatureconfigurator.h"
40 #include "xfaceconfigurator.h"
41 #include "folderrequester.h"
43 #include "kmfoldermgr.h"
44 #include "transportmanager.h"
45 #include "dictionarycombobox.h"
46 #include "kleo_util.h"
47 #include "kmmainwidget.h"
49 #include "templatesconfiguration.h"
50 #include "templatesconfiguration_kfg.h"
51 #include "simplestringlisteditor.h"
55 #include <libkpimidentities/identity.h>
56 #include <libtdepim/addresseelineedit.h>
58 #include <ui/keyrequester.h>
59 #include <kleo/cryptobackendfactory.h>
61 #include <libemailfunctions/email.h>
64 #include <tdelocale.h>
65 #include <tdemessagebox.h>
66 #include <tdeconfig.h>
67 #include <tdefileitem.h>
70 #include <kpushbutton.h>
73 #include <tqtabwidget.h>
75 #include <tqwhatsthis.h>
77 #include <tqpushbutton.h>
78 #include <tqcheckbox.h>
79 #include <tqcombobox.h>
80 #include <tqgroupbox.h>
81 #include <tqtextedit.h>
84 #include <gpgmepp/key.h>
92 IdentityDialog::IdentityDialog( TQWidget * parent,
const char * name )
93 : KDialogBase( Plain, i18n(
"Edit Identity"),
Ok|Cancel|Help,
Ok,
107 TQVBoxLayout * vlay =
new TQVBoxLayout( plainPage(), 0, spacingHint() );
108 TQTabWidget *tabWidget =
new TQTabWidget( plainPage(),
"config-identity-tab" );
109 vlay->addWidget( tabWidget );
111 tab =
new TQWidget( tabWidget );
112 tabWidget->addTab( tab, i18n(
"&General") );
113 glay =
new TQGridLayout( tab, 5, 2, marginHint(), spacingHint() );
114 glay->setRowStretch( 3, 1 );
115 glay->setColStretch( 1, 1 );
119 mNameEdit =
new KLineEdit( tab );
120 glay->addWidget( mNameEdit, row, 1 );
121 label =
new TQLabel( mNameEdit, i18n(
"&Your name:"), tab );
122 glay->addWidget( label, row, 0 );
123 msg = i18n(
"<qt><h3>Your name</h3>"
124 "<p>This field should contain your name as you would like "
125 "it to appear in the email header that is sent out;</p>"
126 "<p>if you leave this blank your real name will not "
127 "appear, only the email address.</p></qt>");
128 TQWhatsThis::add( label, msg );
129 TQWhatsThis::add( mNameEdit, msg );
133 mOrganizationEdit =
new KLineEdit( tab );
134 glay->addWidget( mOrganizationEdit, row, 1 );
135 label =
new TQLabel( mOrganizationEdit, i18n(
"Organi&zation:"), tab );
136 glay->addWidget( label, row, 0 );
137 msg = i18n(
"<qt><h3>Organization</h3>"
138 "<p>This field should have the name of your organization "
139 "if you'd like it to be shown in the email header that "
141 "<p>It is safe (and normal) to leave this blank.</p></qt>");
142 TQWhatsThis::add( label, msg );
143 TQWhatsThis::add( mOrganizationEdit, msg );
147 mEmailEdit =
new KLineEdit( tab );
148 glay->addWidget( mEmailEdit, row, 1 );
149 label =
new TQLabel( mEmailEdit, i18n(
"&Email address:"), tab );
150 glay->addWidget( label, row, 0 );
151 msg = i18n(
"<qt><h3>Email address</h3>"
152 "<p>This field should have your full email address</p>"
153 "<p>This address is the primary one, used for all outgoing mail. "
154 "If you have more than one address, either create a new identity, "
155 "or add additional alias addresses in the field below.</p>"
156 "<p>If you leave this blank, or get it wrong, people "
157 "will have trouble replying to you.</p></qt>");
158 TQWhatsThis::add( label, msg );
159 TQWhatsThis::add( mEmailEdit, msg );
163 mAliasEdit =
new SimpleStringListEditor( tab );
164 glay->addMultiCellWidget( mAliasEdit, row, row+1, 1, 1 );
165 label =
new TQLabel( mAliasEdit, i18n(
"Email a&liases:"), tab );
166 glay->addWidget( label, row, 0, TQt::AlignTop );
167 msg = i18n(
"<qt><h3>Email aliases</h3>"
168 "<p>This field contains alias addresses that should also "
169 "be considered as belonging to this identity (as opposed "
170 "to representing a different identity).</p>"
173 "<tr><th>Primary address:</th><td>first.last@example.org</td></tr>"
174 "<tr><th>Aliases:</th><td>first@example.org<br>last@example.org</td></tr>"
176 "<p>Type one alias address per line.</p></qt>");
177 TQWhatsThis::add( label, msg );
178 TQWhatsThis::add( mAliasEdit, msg );
184 mCryptographyTab = tab =
new TQWidget( tabWidget );
185 tabWidget->addTab( tab, i18n(
"Cryptograph&y") );
186 glay =
new TQGridLayout( tab, 6, 2, marginHint(), spacingHint() );
187 glay->setColStretch( 1, 1 );
191 mPGPSigningKeyRequester =
new Kleo::SigningKeyRequester(
false, Kleo::SigningKeyRequester::OpenPGP, tab );
192 mPGPSigningKeyRequester->dialogButton()->setText( i18n(
"Chang&e...") );
193 mPGPSigningKeyRequester->setDialogCaption( i18n(
"Your OpenPGP Signature Key") );
194 msg = i18n(
"Select the OpenPGP key which should be used to "
195 "digitally sign your messages.");
196 mPGPSigningKeyRequester->setDialogMessage( msg );
198 msg = i18n(
"<qt><p>The OpenPGP key you choose here will be used "
199 "to digitally sign messages. You can also use GnuPG keys.</p>"
200 "<p>You can leave this blank, but KMail will not be able "
201 "to digitally sign emails using OpenPGP; "
202 "normal mail functions will not be affected.</p>"
203 "<p>You can find out more about keys at <a>http://www.gnupg.org</a></p></qt>");
205 label =
new TQLabel( mPGPSigningKeyRequester, i18n(
"OpenPGP signing key:"), tab );
206 TQWhatsThis::add( mPGPSigningKeyRequester, msg );
207 TQWhatsThis::add( label, msg );
209 glay->addWidget( label, row, 0 );
210 glay->addWidget( mPGPSigningKeyRequester, row, 1 );
215 mPGPEncryptionKeyRequester =
new Kleo::EncryptionKeyRequester(
false, Kleo::EncryptionKeyRequester::OpenPGP, tab );
216 mPGPEncryptionKeyRequester->dialogButton()->setText( i18n(
"Chang&e...") );
217 mPGPEncryptionKeyRequester->setDialogCaption( i18n(
"Your OpenPGP Encryption Key") );
218 msg = i18n(
"Select the OpenPGP key which should be used when encrypting "
219 "to yourself and for the \"Attach My Public Key\" "
220 "feature in the composer.");
221 mPGPEncryptionKeyRequester->setDialogMessage( msg );
223 msg = i18n(
"<qt><p>The OpenPGP key you choose here will be used "
224 "to encrypt messages to yourself and for the \"Attach My Public Key\" "
225 "feature in the composer. You can also use GnuPG keys.</p>"
226 "<p>You can leave this blank, but KMail will not be able "
227 "to encrypt copies of outgoing messages to you using OpenPGP; "
228 "normal mail functions will not be affected.</p>"
229 "<p>You can find out more about keys at <a>http://www.gnupg.org</a></qt>");
230 label =
new TQLabel( mPGPEncryptionKeyRequester, i18n(
"OpenPGP encryption key:"), tab );
231 TQWhatsThis::add( mPGPEncryptionKeyRequester, msg );
232 TQWhatsThis::add( label, msg );
234 glay->addWidget( label, row, 0 );
235 glay->addWidget( mPGPEncryptionKeyRequester, row, 1 );
240 mSMIMESigningKeyRequester =
new Kleo::SigningKeyRequester(
false, Kleo::SigningKeyRequester::SMIME, tab );
241 mSMIMESigningKeyRequester->dialogButton()->setText( i18n(
"Chang&e...") );
242 mSMIMESigningKeyRequester->setDialogCaption( i18n(
"Your S/MIME Signature Certificate") );
243 msg = i18n(
"Select the S/MIME certificate which should be used to "
244 "digitally sign your messages.");
245 mSMIMESigningKeyRequester->setDialogMessage( msg );
247 msg = i18n(
"<qt><p>The S/MIME (X.509) certificate you choose here will be used "
248 "to digitally sign messages.</p>"
249 "<p>You can leave this blank, but KMail will not be able "
250 "to digitally sign emails using S/MIME; "
251 "normal mail functions will not be affected.</p></qt>");
252 label =
new TQLabel( mSMIMESigningKeyRequester, i18n(
"S/MIME signing certificate:"), tab );
253 TQWhatsThis::add( mSMIMESigningKeyRequester, msg );
254 TQWhatsThis::add( label, msg );
255 glay->addWidget( label, row, 0 );
256 glay->addWidget( mSMIMESigningKeyRequester, row, 1 );
258 const Kleo::CryptoBackend::Protocol * smimeProtocol
259 = Kleo::CryptoBackendFactory::instance()->smime();
261 label->setEnabled( smimeProtocol );
262 mSMIMESigningKeyRequester->setEnabled( smimeProtocol );
266 mSMIMEEncryptionKeyRequester =
new Kleo::EncryptionKeyRequester(
false, Kleo::EncryptionKeyRequester::SMIME, tab );
267 mSMIMEEncryptionKeyRequester->dialogButton()->setText( i18n(
"Chang&e...") );
268 mSMIMEEncryptionKeyRequester->setDialogCaption( i18n(
"Your S/MIME Encryption Certificate") );
269 msg = i18n(
"Select the S/MIME certificate which should be used when encrypting "
270 "to yourself and for the \"Attach My Certificate\" "
271 "feature in the composer.");
272 mSMIMEEncryptionKeyRequester->setDialogMessage( msg );
274 msg = i18n(
"<qt><p>The S/MIME certificate you choose here will be used "
275 "to encrypt messages to yourself and for the \"Attach My Certificate\" "
276 "feature in the composer.</p>"
277 "<p>You can leave this blank, but KMail will not be able "
278 "to encrypt copies of outgoing messages to you using S/MIME; "
279 "normal mail functions will not be affected.</p></qt>");
280 label =
new TQLabel( mSMIMEEncryptionKeyRequester, i18n(
"S/MIME encryption certificate:"), tab );
281 TQWhatsThis::add( mSMIMEEncryptionKeyRequester, msg );
282 TQWhatsThis::add( label, msg );
284 glay->addWidget( label, row, 0 );
285 glay->addWidget( mSMIMEEncryptionKeyRequester, row, 1 );
287 label->setEnabled( smimeProtocol );
288 mSMIMEEncryptionKeyRequester->setEnabled( smimeProtocol );
292 mPreferredCryptoMessageFormat =
new TQComboBox(
false, tab );
294 l << Kleo::cryptoMessageFormatToLabel( Kleo::AutoFormat )
295 << Kleo::cryptoMessageFormatToLabel( Kleo::InlineOpenPGPFormat )
296 << Kleo::cryptoMessageFormatToLabel( Kleo::OpenPGPMIMEFormat )
297 << Kleo::cryptoMessageFormatToLabel( Kleo::SMIMEFormat )
298 << Kleo::cryptoMessageFormatToLabel( Kleo::SMIMEOpaqueFormat );
299 mPreferredCryptoMessageFormat->insertStringList( l );
300 label =
new TQLabel( mPreferredCryptoMessageFormat,
301 i18n(
"Preferred crypto message format:"), tab );
303 glay->addWidget( label, row, 0 );
304 glay->addWidget( mPreferredCryptoMessageFormat, row, 1 );
307 glay->setRowStretch( row, 1 );
313 tab =
new TQWidget( tabWidget );
314 tabWidget->addTab( tab, i18n(
"&Advanced") );
315 glay =
new TQGridLayout( tab, 8, 2, marginHint(), spacingHint() );
317 glay->setRowStretch( 8-1, 1 );
318 glay->setColStretch( 1, 1 );
322 mReplyToEdit =
new KPIM::AddresseeLineEdit( tab,
true,
"mReplyToEdit" );
323 glay->addWidget( mReplyToEdit, row, 1 );
324 label =
new TQLabel ( mReplyToEdit, i18n(
"&Reply-To address:"), tab);
325 glay->addWidget( label , row, 0 );
326 msg = i18n(
"<qt><h3>Reply-To addresses</h3>"
327 "<p>This sets the <tt>Reply-to:</tt> header to contain a "
328 "different email address to the normal <tt>From:</tt> "
330 "<p>This can be useful when you have a group of people "
331 "working together in similar roles. For example, you "
332 "might want any emails sent to have your email in the "
333 "<tt>From:</tt> field, but any responses to go to "
334 "a group address.</p>"
335 "<p>If in doubt, leave this field blank.</p></qt>");
336 TQWhatsThis::add( label, msg );
337 TQWhatsThis::add( mReplyToEdit, msg );
341 mBccEdit =
new KPIM::AddresseeLineEdit( tab,
true,
"mBccEdit" );
342 glay->addWidget( mBccEdit, row, 1 );
343 label =
new TQLabel( mBccEdit, i18n(
"&BCC addresses:"), tab );
344 glay->addWidget( label, row, 0 );
345 msg = i18n(
"<qt><h3>BCC (Blind Carbon Copy) addresses</h3>"
346 "<p>The addresses that you enter here will be added to each "
347 "outgoing mail that is sent with this identity. They will not "
348 "be visible to other recipients.</p>"
349 "<p>This is commonly used to send a copy of each sent message to "
350 "another account of yours.</p>"
351 "<p>To specify more than one address, use commas to separate "
352 "the list of BCC recipients.</p>"
353 "<p>If in doubt, leave this field blank.</p></qt>");
354 TQWhatsThis::add( label, msg );
355 TQWhatsThis::add( mBccEdit, msg );
359 mDictionaryCombo =
new DictionaryComboBox( tab );
360 glay->addWidget( mDictionaryCombo, row, 1 );
361 glay->addWidget(
new TQLabel( mDictionaryCombo, i18n(
"D&ictionary:"), tab ),
367 kmkernel->getKMMainWidget()->folderTree() );
368 mFccCombo->setShowOutbox(
false );
369 glay->addWidget( mFccCombo, row, 1 );
370 glay->addWidget(
new TQLabel( mFccCombo, i18n(
"Sent-mail &folder:"), tab ),
376 kmkernel->getKMMainWidget()->folderTree() );
377 mDraftsCombo->setShowOutbox(
false );
378 glay->addWidget( mDraftsCombo, row, 1 );
379 glay->addWidget(
new TQLabel( mDraftsCombo, i18n(
"&Drafts folder:"), tab ),
385 kmkernel->getKMMainWidget()->folderTree() );
386 mTemplatesCombo->setShowOutbox(
false );
387 glay->addWidget( mTemplatesCombo, row, 1 );
388 glay->addWidget(
new TQLabel( mTemplatesCombo, i18n(
"&Templates folder:"), tab ),
393 mTransportCheck =
new TQCheckBox( i18n(
"Special &transport:"), tab );
394 glay->addWidget( mTransportCheck, row, 0 );
395 mTransportCombo =
new TQComboBox(
true, tab );
396 mTransportCombo->setEnabled(
false );
398 glay->addWidget( mTransportCombo, row, 1 );
399 connect( mTransportCheck, TQ_SIGNAL(toggled(
bool)),
400 mTransportCombo, TQ_SLOT(setEnabled(
bool)) );
407 tab =
new TQWidget( tabWidget );
408 tabWidget->addTab( tab, i18n(
"&Templates") );
409 vlay =
new TQVBoxLayout( tab, marginHint(), spacingHint() );
410 mCustom =
new TQCheckBox( i18n(
"&Use custom message templates"), tab );
411 vlay->addWidget( mCustom );
412 mWidget =
new TemplatesConfiguration( tab ,
"identity-templates" );
413 mWidget->setEnabled(
false );
414 vlay->addWidget( mWidget );
415 TQHBoxLayout *btns =
new TQHBoxLayout( vlay, spacingHint() );
416 mCopyGlobal =
new KPushButton( i18n(
"&Copy global templates"), tab );
417 mCopyGlobal->setEnabled(
false );
418 btns->addWidget( mCopyGlobal );
419 connect( mCustom, TQ_SIGNAL( toggled(
bool ) ),
420 mWidget, TQ_SLOT( setEnabled(
bool ) ) );
421 connect( mCustom, TQ_SIGNAL( toggled(
bool ) ),
422 mCopyGlobal, TQ_SLOT( setEnabled(
bool ) ) );
423 connect( mCopyGlobal, TQ_SIGNAL(clicked()),
424 this, TQ_SLOT(slotCopyGlobal()) );
429 mSignatureConfigurator =
new SignatureConfigurator( tabWidget );
430 mSignatureConfigurator->layout()->setMargin( KDialog::marginHint() );
431 tabWidget->addTab( mSignatureConfigurator, i18n(
"&Signature") );
433 mXFaceConfigurator =
new XFaceConfigurator( tabWidget );
434 mXFaceConfigurator->layout()->setMargin( KDialog::marginHint() );
435 tabWidget->addTab( mXFaceConfigurator, i18n(
"&Picture") );
437 TDEConfigGroup geometry( KMKernel::config(),
"Geometry" );
438 if ( geometry.hasKey(
"Identity Dialog size" ) )
439 resize( geometry.readSizeEntry(
"Identity Dialog size" ) );
440 mNameEdit->setFocus();
442 connect( tabWidget, TQ_SIGNAL(currentChanged(TQWidget*)),
443 TQ_SLOT(slotAboutToShow(TQWidget*)) );
446 IdentityDialog::~IdentityDialog() {
447 TDEConfigGroup geometry( KMKernel::config(),
"Geometry" );
448 geometry.writeEntry(
"Identity Dialog size", size() );
451 void IdentityDialog::slotAboutToShow( TQWidget * w ) {
452 if ( w == mCryptographyTab ) {
455 const TQString email = mEmailEdit->text().stripWhiteSpace();
456 mPGPEncryptionKeyRequester->setInitialQuery( email );
457 mPGPSigningKeyRequester->setInitialQuery( email );
458 mSMIMEEncryptionKeyRequester->setInitialQuery( email );
459 mSMIMESigningKeyRequester->setInitialQuery( email );
463 void IdentityDialog::slotCopyGlobal() {
464 mWidget->loadFromGlobal();
468 struct DoesntMatchEMailAddress {
469 explicit DoesntMatchEMailAddress(
const TQString & s )
470 : email( s.stripWhiteSpace().lower() ) {}
471 bool operator()(
const GpgME::Key & key )
const;
473 bool checkForEmail(
const char * email )
const;
474 static TQString extractEmail(
const char * email );
475 const TQString email;
478 bool DoesntMatchEMailAddress::operator()(
const GpgME::Key & key )
const {
479 const std::vector<GpgME::UserID> uids = key.userIDs();
480 for ( std::vector<GpgME::UserID>::const_iterator it = uids.begin() ; it != uids.end() ; ++it )
481 if ( checkForEmail( it->email() ? it->email() : it->id() ) )
486 bool DoesntMatchEMailAddress::checkForEmail(
const char * e )
const {
487 const TQString em = extractEmail( e );
488 return !em.isEmpty() && email == em;
491 TQString DoesntMatchEMailAddress::extractEmail(
const char * e ) {
494 const TQString em = TQString::fromUtf8( e );
496 return em.mid( 1, em.length() - 2 );
502 bool IdentityDialog::validateAddresses(
const TQString & addresses )
504 TQString brokenAddress;
506 if ( !( errorCode == KPIM::AddressOk || errorCode == KPIM::AddressEmpty ) ) {
507 TQString errorMsg(
"<qt><p><b>" + brokenAddress +
508 "</b></p><p>" + KPIM::emailParseResultToString( errorCode ) +
510 KMessageBox::sorry(
this, errorMsg, i18n(
"Invalid Email Address") );
516 void IdentityDialog::slotOk() {
517 const TQString email = mEmailEdit->text().stripWhiteSpace();
520 if ( !isValidSimpleEmailAddress( email )) {
521 TQString errorMsg( simpleEmailAddressErrorMsg());
522 KMessageBox::sorry(
this, errorMsg, i18n(
"Invalid Email Address") );
526 const TQStringList aliases = mAliasEdit->stringList();
527 for ( TQStringList::const_iterator it = aliases.begin(), end = aliases.end() ; it != end ; ++it ) {
528 if ( !isValidSimpleEmailAddress( *it ) ) {
529 TQString errorMsg( simpleEmailAddressErrorMsg());
530 KMessageBox::sorry(
this, errorMsg, i18n(
"Invalid Email Alias \"%1\"").arg( *it ) );
535 if ( !validateAddresses( mReplyToEdit->text().stripWhiteSpace() ) ) {
539 if ( !validateAddresses( mBccEdit->text().stripWhiteSpace() ) ) {
543 const std::vector<GpgME::Key> & pgpSigningKeys = mPGPSigningKeyRequester->keys();
544 const std::vector<GpgME::Key> & pgpEncryptionKeys = mPGPEncryptionKeyRequester->keys();
545 const std::vector<GpgME::Key> & smimeSigningKeys = mSMIMESigningKeyRequester->keys();
546 const std::vector<GpgME::Key> & smimeEncryptionKeys = mSMIMEEncryptionKeyRequester->keys();
549 if ( std::find_if( pgpSigningKeys.begin(), pgpSigningKeys.end(),
550 DoesntMatchEMailAddress( email ) ) != pgpSigningKeys.end() ) {
551 msg = i18n(
"One of the configured OpenPGP signing keys does not contain "
552 "any user ID with the configured email address for this "
554 "This might result in warning messages on the receiving side "
555 "when trying to verify signatures made with this configuration.");
558 else if ( std::find_if( pgpEncryptionKeys.begin(), pgpEncryptionKeys.end(),
559 DoesntMatchEMailAddress( email ) ) != pgpEncryptionKeys.end() ) {
560 msg = i18n(
"One of the configured OpenPGP encryption keys does not contain "
561 "any user ID with the configured email address for this "
565 else if ( std::find_if( smimeSigningKeys.begin(), smimeSigningKeys.end(),
566 DoesntMatchEMailAddress( email ) ) != smimeSigningKeys.end() ) {
567 msg = i18n(
"One of the configured S/MIME signing certificates does not contain "
568 "the configured email address for this "
570 "This might result in warning messages on the receiving side "
571 "when trying to verify signatures made with this configuration.");
574 else if ( std::find_if( smimeEncryptionKeys.begin(), smimeEncryptionKeys.end(),
575 DoesntMatchEMailAddress( email ) ) != smimeEncryptionKeys.end() ) {
576 msg = i18n(
"One of the configured S/MIME encryption certificates does not contain "
577 "the configured email address for this "
583 if ( KMessageBox::warningContinueCancel(
this, msg.arg( email ),
584 i18n(
"Email Address Not Found in Key/Certificates"),
585 KStdGuiItem::cont(),
"warn_email_not_in_certificate" )
586 != KMessageBox::Continue)
590 if ( mSignatureConfigurator->isSignatureEnabled() &&
591 mSignatureConfigurator->signatureType()==Signature::FromFile ) {
592 KURL url( mSignatureConfigurator->fileURL() );
593 KFileItem signatureFile( KFileItem::Unknown, KFileItem::Unknown, url );
594 if ( !signatureFile.isFile() || !signatureFile.isReadable() || !signatureFile.isLocalFile() ) {
595 KMessageBox::error(
this, i18n(
"The signature file is not valid" ) );
600 return KDialogBase::slotOk();
603 bool IdentityDialog::checkFolderExists(
const TQString & folderID,
604 const TQString & msg ) {
605 KMFolder * folder = kmkernel->findFolderById( folderID );
607 KMessageBox::sorry(
this, msg );
613 void IdentityDialog::setIdentity( KPIM::Identity & ident ) {
615 setCaption( i18n(
"Edit Identity \"%1\"").arg( ident.identityName() ) );
618 mNameEdit->setText( ident.fullName() );
619 mOrganizationEdit->setText( ident.organization() );
620 mEmailEdit->setText( ident.primaryEmailAddress() );
621 mAliasEdit->setStringList( ident.emailAliases() );
624 mPGPSigningKeyRequester->setFingerprint( ident.pgpSigningKey() );
625 mPGPEncryptionKeyRequester->setFingerprint( ident.pgpEncryptionKey() );
626 mSMIMESigningKeyRequester->setFingerprint( ident.smimeSigningKey() );
627 mSMIMEEncryptionKeyRequester->setFingerprint( ident.smimeEncryptionKey() );
628 mPreferredCryptoMessageFormat->setCurrentItem( format2cb( ident.preferredCryptoMessageFormat() ) );
631 mReplyToEdit->setText( ident.replyToAddr() );
632 mBccEdit->setText( ident.bcc() );
633 mTransportCheck->setChecked( !ident.transport().isEmpty() );
634 mTransportCombo->setEditText( ident.transport() );
635 mTransportCombo->setEnabled( !ident.transport().isEmpty() );
636 mDictionaryCombo->setCurrentByDictionary( ident.dictionary() );
638 if ( ident.fcc().isEmpty() ||
639 !checkFolderExists( ident.fcc(),
640 i18n(
"The custom sent-mail folder for identity "
641 "\"%1\" does not exist (anymore); "
642 "therefore, the default sent-mail folder "
644 .arg( ident.identityName() ) ) )
645 mFccCombo->setFolder( kmkernel->sentFolder() );
647 mFccCombo->setFolder( ident.fcc() );
649 if ( ident.drafts().isEmpty() ||
650 !checkFolderExists( ident.drafts(),
651 i18n(
"The custom drafts folder for identity "
652 "\"%1\" does not exist (anymore); "
653 "therefore, the default drafts folder "
655 .arg( ident.identityName() ) ) )
656 mDraftsCombo->setFolder( kmkernel->draftsFolder() );
658 mDraftsCombo->setFolder( ident.drafts() );
660 if ( ident.templates().isEmpty() ||
661 !checkFolderExists( ident.templates(),
662 i18n(
"The custom templates folder for identity "
663 "\"%1\" does not exist (anymore); "
664 "therefore, the default templates folder "
666 .arg( ident.identityName() ) ) )
667 mTemplatesCombo->setFolder( kmkernel->templatesFolder() );
669 mTemplatesCombo->setFolder( ident.templates() );
672 uint identity = ident.uoid();
673 TQString iid = TQString(
"IDENTITY_%1").arg( identity );
675 mCustom->setChecked(t.useCustomTemplates());
676 mWidget->loadFromIdentity( identity );
679 mSignatureConfigurator->setSignature( ident.signature() );
680 mXFaceConfigurator->setXFace( ident.xface() );
681 mXFaceConfigurator->setXFaceEnabled( ident.isXFaceEnabled() );
684 void IdentityDialog::updateIdentity( KPIM::Identity & ident ) {
686 ident.setFullName( mNameEdit->text() );
687 ident.setOrganization( mOrganizationEdit->text() );
688 TQString email = mEmailEdit->text();
689 ident.setPrimaryEmailAddress( email );
690 const TQStringList aliases = mAliasEdit->stringList();
691 ident.setEmailAliases( aliases );
693 ident.setPGPSigningKey( mPGPSigningKeyRequester->fingerprint().latin1() );
694 ident.setPGPEncryptionKey( mPGPEncryptionKeyRequester->fingerprint().latin1() );
695 ident.setSMIMESigningKey( mSMIMESigningKeyRequester->fingerprint().latin1() );
696 ident.setSMIMEEncryptionKey( mSMIMEEncryptionKeyRequester->fingerprint().latin1() );
697 ident.setPreferredCryptoMessageFormat( cb2format( mPreferredCryptoMessageFormat->currentItem() ) );
699 ident.setReplyToAddr( mReplyToEdit->text() );
700 ident.setBcc( mBccEdit->text() );
701 ident.setTransport( ( mTransportCheck->isChecked() ) ?
702 mTransportCombo->currentText() : TQString() );
703 ident.setDictionary( mDictionaryCombo->currentDictionary() );
704 ident.setFcc( mFccCombo->folder() ?
705 mFccCombo->folder()->idString() : TQString() );
706 ident.setDrafts( mDraftsCombo->folder() ?
707 mDraftsCombo->folder()->idString() : TQString() );
708 ident.setTemplates( mTemplatesCombo->folder() ?
709 mTemplatesCombo->folder()->idString() : TQString() );
711 uint identity = ident.uoid();
712 TQString iid = TQString(
"IDENTITY_%1").arg( identity );
714 kdDebug() <<
"use custom templates for identity " << identity <<
": " << mCustom->isChecked() << endl;
715 t.setUseCustomTemplates(mCustom->isChecked());
717 mWidget->saveToIdentity( identity );
719 ident.setSignature( mSignatureConfigurator->signature() );
720 ident.setXFace( mXFaceConfigurator->xface() );
721 ident.setXFaceEnabled( mXFaceConfigurator->isXFaceEnabled() );
724 void IdentityDialog::slotUpdateTransportCombo(
const TQStringList & sl ) {
726 TQString content = mTransportCombo->currentText();
728 mTransportCombo->clear();
729 mTransportCombo->insertStringList( sl );
731 mTransportCombo->setEditText( content );
736 #include "identitydialog.moc"
static KPIM::EmailParseResult isValidEmailAddressList(const TQString &aStr, TQString &brokenAddress)
Validate a list of email addresses, and also allow aliases and distribution lists to be expanded befo...
static TQString expandAliases(const TQString &recipients)
Expands aliases (distribution lists and nick names) and appends a domain part to all email addresses ...
A widget that contains a KLineEdit which shows the current folder and a button that fires a KMFolderS...
static TQStringList transportNames()
Returns the list for transport names.
@ Ok
The user rights/ACL have been fetched from the server sucessfully.