[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_4_BRANCH: kdepim/kmail
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2005-04-12 9:39:40
Message-ID: 20050412093940.3D2D3633 () office ! kde ! org
[Download RAW message or body]

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

--- 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:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic