Patch by Matt Douhan <matt@fruitsalad.org>

Don't overwrite bcc addresses the user already editted when changing to an
identity with a bcc address. Also fixes several other corner cases in that
area.

Thanks, Matt.

CCMAIL: 67115-done@bugs.kde.org

svn path=/trunk/kdepim/; revision=338138
wilder-work
Till Adam 22 years ago
parent 472e7f544f
commit e8c3d343b5
  1. 52
      kmcomposewin.cpp

@ -3346,34 +3346,66 @@ void KMComposeWin::focusNextPrevEdit(const QWidget* aCur, bool aNext)
}
//-----------------------------------------------------------------------------
void KMComposeWin::slotIdentityChanged(uint uoid)
void KMComposeWin::slotIdentityChanged( uint uoid )
{
const KPIM::Identity & ident =
kmkernel->identityManager()->identityForUoid( uoid );
if ( ident.isNull() ) return;
if( ident.isNull() ) return;
if(!ident.fullEmailAddr().isNull())
if( !ident.fullEmailAddr().isNull() )
mEdtFrom->setText(ident.fullEmailAddr());
// make sure the From field is shown if it's empty
if ( from().isEmpty() )
mShowHeaders |= HDR_FROM;
mEdtReplyTo->setText(ident.replyToAddr());
// don't overwrite the BCC field when the user has edited it and the
// BCC field of the new identity is empty
if( !mEdtBcc->edited() || !ident.bcc().isEmpty() )
mEdtBcc->setText(ident.bcc());
// BCC field of the new identity is not empty
if( !mEdtBcc->edited() && !ident.bcc().isEmpty() ) {
if( mEdtBcc->text().isEmpty() ) {
mEdtBcc->setText( ident.bcc() );
} else {
// user type into the editbox an address that != to the preset bcc
// of the identity, we assume that since the user typed it
// they want to keep it
if ( mEdtBcc->text() != ident.bcc() ) {
QString temp_string( mEdtBcc->text() + QString::fromLatin1(",") + ident.bcc() );
mEdtBcc->setText( temp_string );
} else {
// if the user typed the same address as the preset BCC
// from the identity we will overwrite it to avoid duplicates.
mEdtBcc->setText( ident.bcc() );
}
}
}
// user edited the bcc box and has a preset bcc in the identity
// we will append whatever the user typed to the preset address
// allowing the user to keep all addresses
if( mEdtBcc->edited() && !ident.bcc().isEmpty() ) {
if( !mEdtBcc->text().isEmpty() ) {
QString temp_string ( mEdtBcc->text() + QString::fromLatin1(",") + ident.bcc() );
mEdtBcc->setText( temp_string );
} else {
mEdtBcc->setText( ident.bcc() );
}
}
// user typed nothing and the identity does not have a preset bcc
// we then reset the value to get rid of any previous
// values if the user changed identity mid way through.
if( !mEdtBcc->edited() && ident.bcc().isEmpty() ) {
mEdtBcc->setText( ident.bcc() );
}
// make sure the BCC field is shown because else it's ignored
if (! ident.bcc().isEmpty()) {
if ( !ident.bcc().isEmpty() ) {
mShowHeaders |= HDR_BCC;
}
if (ident.organization().isEmpty())
if ( ident.organization().isEmpty() )
mMsg->removeHeaderField("Organization");
else
mMsg->setHeaderField("Organization", ident.organization());
if (!mBtnTransport->isChecked()) {
if ( !mBtnTransport->isChecked() ) {
QString transp = ident.transport();
if (transp.isEmpty())
if ( transp.isEmpty() )
{
mMsg->removeHeaderField("X-KMail-Transport");
transp = mTransport->text(0);

Loading…
Cancel
Save