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.

svn path=/branches/KDE_3_4_BRANCH/kdepim/; revision=405010
wilder-work
Cornelius Schumacher 21 years ago
parent f132cf242a
commit 15b82fd55b
  1. 7
      kmail.kcfg
  2. 29
      recipientseditor.cpp
  3. 2
      recipientseditor.h

@ -327,6 +327,13 @@
</choices>
<default>MultiLine</default>
</entry>
<entry name="SecondRecipientTypeDefault" type="Enum">
<choices>
<choice name="To"/>
<choice name="Cc"/>
</choices>
<default>To</default>
</entry>
<entry name="MaximumRecipients" type="Int">
<label>Maximum number of recipient editor lines.</label>
<default>200</default>

@ -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 )
{

@ -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<RecipientLine> mLines;

Loading…
Cancel
Save