CVS commit by cschumac: Try to be smart about default type of second recipient line in order to make everybody happy. The default of the default is To again. M +7 -0 kmail.kcfg 1.39.2.1 M +26 -3 recipientseditor.cpp 1.43.2.2 M +2 -0 recipientseditor.h 1.24.2.1 --- kdepim/kmail/kmail.kcfg #1.39:1.39.2.1 @@ -328,4 +328,11 @@ MultiLine + + + + + + To + --- kdepim/kmail/recipientseditor.cpp #1.43.2.1:1.43.2.2 @@ -193,4 +193,6 @@ void RecipientLine::slotTypeModified() { mModified = true; + + emit typeModified( this ); } @@ -344,9 +346,15 @@ RecipientLine *RecipientsView::addLine() SLOT( slotDecideLineDeletion( RecipientLine * ) ) ); connect( line, SIGNAL( countChanged() ), SLOT( calculateTotal() ) ); + connect( line, SIGNAL( typeModified( RecipientLine * ) ), + SLOT( slotTypeModified( RecipientLine * ) ) ); if ( mLines.last() ) { - if ( mLines.count() == 1 && - mLines.last()->recipientType() == Recipient::To ) { + if ( mLines.count() == 1 ) { + if ( GlobalSettings::secondRecipientTypeDefault() == + GlobalSettings::EnumSecondRecipientTypeDefault::To ) { + line->setRecipientType( Recipient::To ); + } else { line->setRecipientType( Recipient::Cc ); + } } else { line->setRecipientType( mLines.last()->recipientType() ); @@ -378,4 +386,19 @@ RecipientLine *RecipientsView::addLine() } +void RecipientsView::slotTypeModified( RecipientLine *line ) +{ + if ( mLines.count() == 2 || + ( mLines.count() == 3 && mLines.at( 2 )->isEmpty() ) ) { + if ( mLines.at( 1 ) == line ) { + if ( line->recipientType() == Recipient::To ) { + GlobalSettings::setSecondRecipientTypeDefault( + GlobalSettings::EnumSecondRecipientTypeDefault::To ); + } else if ( line->recipientType() == Recipient::Cc ) { + GlobalSettings::setSecondRecipientTypeDefault( + GlobalSettings::EnumSecondRecipientTypeDefault::Cc ); + } + } + } +} void RecipientLine::setRemoveLineButtonEnabled( bool b ) --- kdepim/kmail/recipientseditor.h #1.24:1.24.2.1 @@ -144,4 +144,5 @@ class RecipientLine : public QWidget void deleteLine( RecipientLine * ); void countChanged(); + void typeModified( RecipientLine * ); protected: @@ -222,4 +223,5 @@ class RecipientsView : public QScrollVie void slotDeleteLine(); void calculateTotal(); + void slotTypeModified( RecipientLine * ); private: