diff --git a/kmail.kcfg b/kmail.kcfg
index 3646f40b2..dcb04ffaf 100644
--- a/kmail.kcfg
+++ b/kmail.kcfg
@@ -327,6 +327,13 @@
MultiLine
+
+
+
+
+
+ To
+
200
diff --git a/recipientseditor.cpp b/recipientseditor.cpp
index 883f909e3..15d061c55 100644
--- a/recipientseditor.cpp
+++ b/recipientseditor.cpp
@@ -192,6 +192,8 @@ void RecipientLine::slotFocusDown()
void RecipientLine::slotTypeModified()
{
mModified = true;
+
+ emit typeModified( this );
}
void RecipientLine::analyzeLine( const QString &text )
@@ -343,11 +345,17 @@ RecipientLine *RecipientsView::addLine()
connect( line, SIGNAL( deleteLine( RecipientLine * ) ),
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 ) {
- line->setRecipientType( Recipient::Cc );
+ 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() );
}
@@ -377,6 +385,21 @@ RecipientLine *RecipientsView::addLine()
return line;
}
+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 )
{
diff --git a/recipientseditor.h b/recipientseditor.h
index 563497f3f..3bf0ca52e 100644
--- a/recipientseditor.h
+++ b/recipientseditor.h
@@ -143,6 +143,7 @@ class RecipientLine : public QWidget
void rightPressed();
void deleteLine( RecipientLine * );
void countChanged();
+ void typeModified( RecipientLine * );
protected:
void keyPressEvent( QKeyEvent * );
@@ -221,6 +222,7 @@ class RecipientsView : public QScrollView
void slotDecideLineDeletion( RecipientLine * );
void slotDeleteLine();
void calculateTotal();
+ void slotTypeModified( RecipientLine * );
private:
QPtrList mLines;