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

List:       kmail-devel
Subject:    RFC: new Fcc field
From:       Roberto Teixeira <maragato () kde ! org>
Date:       2001-10-21 19:40:40
[Download RAW message or body]

Hi,

one thing I was missing in Kmail was the possibility to select a different 
folder than sent-mail when I was writing a mail. I could use outgoing filters 
for a lot of cases, but sometimes we have to manually select the folder.

This patch creates this option. First you can configure a special sent-mail 
folder for each identity you have (if there's none selected, we use 
kernel->sentFolder()). Secondly, this adds an option (a combobox) to the 
composer window to allow me to select a different one for that specific 
message.

One problem I have is the field label. I am using Fcc (folder carbon copy) 
right now because that's the name I got used to when I used Gnus. However, I 
think we must come up with a more user friendly name.

So I'd appreciate comments and if it's ok I'd like to commit it.

regards,

	Roberto.

-- 
maragato@conectiva.com | maragato@kde.org

pub key: 0x140432C6 
Fingerprint: 4AD2 28FF 3D30 51E4 F84B  E9C3 176D 98D8 1404 32C6

DISCLAIMER: This message represents the official views of the voices in
my head. If the informations contained in this message cause any trouble
at all I will plead insanity and get on with my life, so please do not
even bother sueing.

["fcc.diff" (text/x-diff)]

Index: configuredialog.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/configuredialog.cpp,v
retrieving revision 1.151
diff -u -b -t -r1.151 configuredialog.cpp
--- configuredialog.cpp	2001/10/20 09:46:43	1.151
+++ configuredialog.cpp	2001/10/21 19:27:15
@@ -57,6 +57,7 @@
 #include "kmacctmgr.h"
 #include "kmacctseldlg.h"
 #include "kmfolder.h"
+#include "kmfoldermgr.h"
 #include "kmheaders.h"
 #include "kmidentity.h"
 #include "kmsender.h"
@@ -558,18 +559,25 @@
   label->setBuddy(mIdentity.replytoEdit);
   glay->addMultiCellWidget( mIdentity.replytoEdit, 5, 5, 1, 2 );
 
-  label = new QLabel( i18n("PGP &User Identity:"), page );
+  label = new QLabel( i18n("Fcc"), page );
   glay->addWidget( label, 6, 0 );
+  mIdentity.fccCombo = new QComboBox( page );
+  mIdentity.fccCombo->setEditable( FALSE );
+  label->setBuddy(mIdentity.fccCombo);
+  glay->addMultiCellWidget( mIdentity.fccCombo, 6, 6, 1, 2 );
+
+  label = new QLabel( i18n("PGP &User Identity:"), page );
+  glay->addWidget( label, 7, 0 );
   mIdentity.pgpIdentityEdit = new QLineEdit( page );
   label->setBuddy(mIdentity.pgpIdentityEdit);
-  glay->addMultiCellWidget( mIdentity.pgpIdentityEdit, 6, 6, 1, 2 );
+  glay->addMultiCellWidget( mIdentity.pgpIdentityEdit, 7, 7, 1, 2 );
 
   mIdentity.transportCheck = new QCheckBox( i18n("Spe&cial transport"), page );
-  glay->addWidget( mIdentity.transportCheck, 7, 0 );
+  glay->addWidget( mIdentity.transportCheck, 8, 0 );
   mIdentity.transportCombo = new QComboBox( page );
   mIdentity.transportCombo->setEditable( TRUE );
   label->setBuddy(mIdentity.transportCombo);
-  glay->addMultiCellWidget( mIdentity.transportCombo, 7, 7, 1, 2 );
+  glay->addMultiCellWidget( mIdentity.transportCombo, 8, 8, 1, 2 );
   connect(mIdentity.transportCheck, SIGNAL(clicked()),
     SLOT(slotSpecialTransportClicked()));
 
@@ -580,10 +588,10 @@
   mIdentity.signatureFileRadio =
     new QRadioButton( i18n("&Use a signature from file"), page );
   buttonGroup->insert( mIdentity.signatureFileRadio );
-  glay->addMultiCellWidget( mIdentity.signatureFileRadio, 8, 8, 0, 1 );
+  glay->addMultiCellWidget( mIdentity.signatureFileRadio, 9, 9, 0, 1 );
 
   mIdentity.signatureFileLabel = new QLabel( i18n("&Signature File:"), page );
-  glay->addWidget( mIdentity.signatureFileLabel, 9, 0 );
+  glay->addWidget( mIdentity.signatureFileLabel, 10, 0 );
   mIdentity.signatureFileEdit = new KURLRequester( page );
   mIdentity.signatureFileLabel->setBuddy(mIdentity.signatureFileEdit);
   QPushButton *button = mIdentity.signatureFileEdit->button();
@@ -591,26 +599,26 @@
   button->setAutoDefault( false );
   connect( mIdentity.signatureFileEdit, SIGNAL(textChanged(const QString &)),
            this, SLOT( slotSignatureFile(const QString &)) );
-  glay->addMultiCellWidget( mIdentity.signatureFileEdit, 9, 9, 1, 2 );
+  glay->addMultiCellWidget( mIdentity.signatureFileEdit, 10, 10, 1, 2 );
 
   mIdentity.signatureExecCheck =
     new QCheckBox( i18n("&The file is a program"), page );
-  glay->addWidget( mIdentity.signatureExecCheck, 10, 1 );
+  glay->addWidget( mIdentity.signatureExecCheck, 11, 1 );
   mIdentity.signatureEditButton = new QPushButton( i18n("Ed&it File"), page );
   connect( mIdentity.signatureEditButton, SIGNAL(clicked()),
            this, SLOT(slotSignatureEdit()) );
   mIdentity.signatureEditButton->setAutoDefault( false );
-  glay->addWidget( mIdentity.signatureEditButton, 10, 2 );
+  glay->addWidget( mIdentity.signatureEditButton, 11, 2 );
   button->setMinimumSize( mIdentity.signatureEditButton->sizeHint() );
 
   mIdentity.signatureTextRadio =
     new QRadioButton( i18n("&Specify signature below"), page );
   buttonGroup->insert( mIdentity.signatureTextRadio );
-  glay->addMultiCellWidget( mIdentity.signatureTextRadio, 11, 11, 0, 2 );
+  glay->addMultiCellWidget( mIdentity.signatureTextRadio, 12, 12, 0, 2 );
 
   mIdentity.signatureTextEdit = new QMultiLineEdit( page );
   mIdentity.signatureTextEdit->setText("Does not work yet");
-  glay->addMultiCellWidget( mIdentity.signatureTextEdit, 12, 12, 0, 2 );
+  glay->addMultiCellWidget( mIdentity.signatureTextEdit, 13, 13, 0, 2 );
 }
 
 
@@ -1595,14 +1603,18 @@
   setupMiscPage();
 }
 
-
-
 void ConfigureDialog::setupIdentityPage( void )
 {
   mIdentityList.importData();
   mIdentity.identityCombo->clear();
   mIdentity.identityCombo->insertStringList( mIdentityList.identities() );
   mIdentity.mActiveIdentity = "";
+  // populate fcc folder list
+  QStringList names;
+  QValueList<QGuardedPtr<KMFolder> > folders;
+  kernel->folderMgr()->createI18nFolderList(&names, &folders);
+  mIdentity.fccCombo->insertStringList(names);
+
   slotIdentitySelectorChanged(); // This will trigger an update
 }
 
@@ -2507,6 +2519,7 @@
     entry->setUseSignatureFile( mIdentity.signatureFileRadio->isChecked() );
     entry->setTransport( (mIdentity.transportCheck->isChecked()) ?
       mIdentity.transportCombo->currentText() : QString::null );
+    entry->setFcc( mIdentity.fccCombo->currentText() );
   }
 }
 
@@ -2543,7 +2556,13 @@
     useSignatureFile = true;
     mIdentity.transportCheck->setChecked( false );
     mIdentity.transportCombo->setEditText( QString::null );
+    for (int i=0; i < mIdentity.fccCombo->count(); ++i)
+      if (mIdentity.fccCombo->text(i) == kernel->sentFolder()->label())
+      {
+          mIdentity.fccCombo->setCurrentItem(i);
+          break;
   }
+  }
   else
   {
     mIdentity.nameEdit->setText( entry->fullName() );
@@ -2558,7 +2577,13 @@
     mIdentity.transportCheck->setChecked(!entry->transport().isEmpty());
     mIdentity.transportCombo->setEditText(entry->transport());
     mIdentity.transportCombo->setEnabled(!entry->transport().isEmpty());
+    for (int i=0; i < mIdentity.fccCombo->count(); ++i)
+      if (mIdentity.fccCombo->text(i).stripWhiteSpace() == entry->fcc())
+      {
+          mIdentity.fccCombo->setCurrentItem(i);
+          break;
   }
+  }
 
   if( useSignatureFile == true )
   {
@@ -3702,6 +3727,11 @@
   return ( mTransport );
 }
 
+QString IdentityEntry::fcc() const
+{
+  return ( mFcc );
+}
+
 
 void IdentityEntry::setIdentity( const QString &identity )
 {
@@ -3775,6 +3805,10 @@
   mTransport = transport;
 }
 
+void IdentityEntry::setFcc( const QString &fcc )
+{
+  mFcc = fcc.stripWhiteSpace();
+}
 
 
 IdentityList::IdentityList()
@@ -3844,6 +3878,7 @@
     entry.setSignatureInlineText( ident.signatureInlineText() );
     entry.setUseSignatureFile( ident.useSignatureFile() );
     entry.setTransport(ident.transport());
+    entry.setFcc(ident.fcc());
     add( entry );
   }
 }
@@ -3864,6 +3899,7 @@
     ident.setSignatureFile( e->signatureFileName(true) );
     ident.setSignatureInlineText( e->signatureInlineText() );
     ident.setTransport( e->transport() );
+    ident.setFcc( e->fcc() );
     ident.writeConfig(false);
     ids.append( e->identity() );
   }
Index: configuredialog.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/configuredialog.h,v
retrieving revision 1.52
diff -u -b -t -r1.52 configuredialog.h
--- configuredialog.h	2001/09/20 14:11:44	1.52
+++ configuredialog.h	2001/10/21 19:27:15
@@ -120,6 +120,7 @@
     bool    signatureFileIsAProgram() const;
     bool    useSignatureFile() const;
     QString transport() const;
+    QString fcc() const;
 
     void setIdentity( const QString &identity );
     void setFullName( const QString &fullName );
@@ -133,6 +134,7 @@
     void setSignatureFileIsAProgram( bool signatureFileIsAProgram );
     void setUseSignatureFile( bool useSignatureFile );
     void setTransport(const QString &transport);
+    void setFcc( const QString &fcc );
 
   private:
     QString mIdentity;
@@ -146,6 +148,7 @@
     bool    mSignatureFileIsAProgram;
     bool    mUseSignatureFile;
     QString mTransport;
+    QString mFcc;
 };
 
 
@@ -261,6 +264,7 @@
       QLineEdit      *pgpIdentityEdit;
       QCheckBox      *transportCheck;
       QComboBox      *transportCombo;
+      QComboBox      *fccCombo;
       KURLRequester  *signatureFileEdit;
       QLabel         *signatureFileLabel;
       QCheckBox      *signatureExecCheck;
Index: kmcomposerui.rc
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposerui.rc,v
retrieving revision 1.12
diff -u -b -t -r1.12 kmcomposerui.rc
--- kmcomposerui.rc	2000/11/16 17:15:27	1.12
+++ kmcomposerui.rc	2001/10/21 19:27:15
@@ -43,6 +43,7 @@
    <Action name="show_to" />
    <Action name="show_cc" />
    <Action name="show_bcc" />
+   <Action name="show_fcc" />
    <Action name="show_subject" />
   </Menu>
   <Menu name="attach" >
Index: kmcomposewin.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposewin.cpp,v
retrieving revision 1.404
diff -u -b -t -r1.404 kmcomposewin.cpp
--- kmcomposewin.cpp	2001/10/20 10:26:42	1.404
+++ kmcomposewin.cpp	2001/10/21 19:27:16
@@ -16,6 +16,7 @@
 #include "kmaddrbookdlg.h"
 #include "kmaddrbook.h"
 #include "kmfolder.h"
+#include "kmfoldermgr.h"
 #include "kmtransport.h"
 
 #include <kaction.h>
@@ -75,6 +76,7 @@
   mEdtTo = new KMLineEdit(this,true,mMainWidget);
   mEdtCc = new KMLineEdit(this,true,mMainWidget);
   mEdtBcc = new KMLineEdit(this,true,mMainWidget);
+  mFcc = new QComboBox(mMainWidget);
   mEdtSubject = new KMLineEdit(this,false,mMainWidget, "subjectLine");
   mLblIdentity = new QLabel(mMainWidget);
   mLblTransport = new QLabel(mMainWidget);
@@ -83,9 +85,11 @@
   mLblTo = new QLabel(mMainWidget);
   mLblCc = new QLabel(mMainWidget);
   mLblBcc = new QLabel(mMainWidget);
+  mLblFcc = new QLabel(mMainWidget);
   mLblSubject = new QLabel(mMainWidget);
   mBtnIdentity = new QCheckBox(i18n("Sticky"),mMainWidget);
   mBtnTransport = new QCheckBox(i18n("Sticky"),mMainWidget);
+  mBtnFcc = new QCheckBox(i18n("Sticky"),mMainWidget);
   mBtnTo = new QPushButton("...",mMainWidget);
   mBtnCc = new QPushButton("...",mMainWidget);
   mBtnBcc = new QPushButton("...",mMainWidget);
@@ -119,6 +123,7 @@
   mBtnBcc->setFocusPolicy(QWidget::NoFocus);
   mBtnFrom->setFocusPolicy(QWidget::NoFocus);
   mBtnReplyTo->setFocusPolicy(QWidget::NoFocus);
+  mFcc->setFocusPolicy(QWidget::NoFocus);
 
   mAtmListBox = new QListView(mMainWidget, "mAtmListBox");
   mAtmListBox->setFocusPolicy(QWidget::NoFocus);
@@ -251,7 +256,6 @@
   mEditor->setText(body);
 }
 
-
 //-----------------------------------------------------------------------------
 bool KMComposeWin::event(QEvent *e)
 {
@@ -331,6 +335,10 @@
   mBtnIdentity->setChecked(config->readBoolEntry("sticky-identity", false));
   if (mBtnIdentity->isChecked())
     mId = config->readEntry("previous-identity", mId );
+  mBtnFcc->setChecked(config->readBoolEntry("sticky-fcc", false));
+  QString previousFcc = kernel->sentFolder()->label();
+  if (mBtnFcc->isChecked())
+    previousFcc = config->readEntry("previous-fcc", previousFcc );
   mBtnTransport->setChecked(config->readBoolEntry("sticky-transport", false));
   mTransportHistory = config->readListEntry("transport-history");
   QString currentTransport = config->readEntry("current-transport");
@@ -417,9 +425,32 @@
   mTransport->insertStringList( mTransportHistory );
   if (mBtnTransport->isChecked() && !currentTransport.isEmpty())
     mTransport->setEditText( currentTransport );
-}
 
+  QStringList names;
+  QValueList<QGuardedPtr<KMFolder> > folders;
+  kernel->folderMgr()->createI18nFolderList(&names, &folders);
+  mFcc->insertStringList(names);
+
+  if ( !mBtnFcc->isChecked() )
+  {
+      kdDebug(5006) << "KMComposeWin::readConfig. " << mIdentity->currentText() << \
endl; +      KMIdentity i( mIdentity->currentText() );
+      kdDebug(5006) << "KMComposeWin::readConfig: identity.fcc()='" << i.fcc() << \
"'" << endl; +      i.readConfig();
+      if ( i.fcc().isEmpty() )
+          i.setFcc( kernel->sentFolder()->label() );
+      previousFcc = i.fcc();
+      kdDebug() << "KMComposeWin::readConfig: previousFcc=" << previousFcc <<  endl;
+  }
 
+  for (int i=0; i < mFcc->count(); ++i)
+      if (mFcc->text(i) == previousFcc)
+      {
+          mFcc->setCurrentItem(i);
+          break;
+      }
+}
+
 //-----------------------------------------------------------------------------
 void KMComposeWin::writeConfig(void)
 {
@@ -514,6 +545,8 @@
     id = HDR_BCC;
   else if (act == subjectAction)
     id = HDR_SUBJECT;
+  else if (act == fccAction)
+    id = HDR_FCC;
    else
    {
      id = 0;
@@ -589,6 +622,9 @@
   if (!fromSlot) bccAction->setChecked(abs(mShowHeaders)&HDR_BCC);
   rethinkHeaderLine(showHeaders,HDR_BCC, row, i18n("&Bcc:"),
                     mLblBcc, mEdtBcc, mBtnBcc);
+  if (!fromSlot) fccAction->setChecked(abs(mShowHeaders)&HDR_FCC);
+  rethinkHeaderLine(showHeaders,HDR_FCC, row, i18n("&Fcc:"),
+                    mLblFcc, mFcc, mBtnFcc);
   if (!fromSlot) subjectAction->setChecked(abs(mShowHeaders)&HDR_SUBJECT);
   rethinkHeaderLine(showHeaders,HDR_SUBJECT, row, i18n("S&ubject:"),
                     mLblSubject, mEdtSubject);
@@ -611,6 +647,7 @@
   toAction->setEnabled(!allFieldsAction->isChecked());
   ccAction->setEnabled(!allFieldsAction->isChecked());
   bccAction->setEnabled(!allFieldsAction->isChecked());
+  fccAction->setEnabled(!allFieldsAction->isChecked());
   subjectAction->setEnabled(!allFieldsAction->isChecked());
 }
 
@@ -798,6 +835,9 @@
   bccAction = new KToggleAction (i18n("&Bcc"), 0, this,
                                  SLOT(slotView()),
                                  actionCollection(), "show_bcc");
+  fccAction = new KToggleAction (i18n("&Fcc"), 0, this,
+                                 SLOT(slotView()),
+                                 actionCollection(), "show_fcc");
   subjectAction = new KToggleAction (i18n("&Subject"), 0, this,
                                      SLOT(slotView()),
                                      actionCollection(), "show_subject");
@@ -1116,6 +1156,14 @@
   mMsg->setReplyTo(replyTo());
   mMsg->setBcc(bcc());
 
+  KMIdentity id( mIdentity->currentText() );
+  id.readConfig();
+  kdDebug() << "KMComposeWin::applyChanges: " << mFcc->currentText() << "==" << \
id.fcc() << "?" << endl; +  if ( mFcc->currentText().stripWhiteSpace() == id.fcc() )
+      mMsg->setFcc( QString::null );
+  else
+      mMsg->setFcc(mFcc->currentText());
+
   if (mIdentity->currentText() == i18n("Default"))
     mMsg->removeHeaderField("X-KMail-Identity");
   else mMsg->setHeaderField("X-KMail-Identity", mIdentity->currentText());
@@ -2379,6 +2427,19 @@
       mTransport->insertItem(transp,i);
       mTransport->setCurrentItem(i);
     }
+  }
+
+  if ( !mBtnFcc->isChecked() )
+  {
+      if ( ident.fcc().isEmpty() )
+          ident.setFcc( kernel->sentFolder()->label() );
+
+      for ( int i = 0; i < mFcc->count(); ++i )
+          if ( mFcc->text(i) == ident.fcc() )
+          {
+              mFcc->setCurrentItem( i );
+              break;
+          }
   }
 
   if (((pos >= 0) && (pos + mOldSigText.length() + 5 == edtText.length())) ||
Index: kmcomposewin.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposewin.h,v
retrieving revision 1.128
diff -u -b -t -r1.128 kmcomposewin.h
--- kmcomposewin.h	2001/10/20 09:46:44	1.128
+++ kmcomposewin.h	2001/10/21 19:27:16
@@ -479,11 +479,11 @@
 
 protected:
   QWidget   *mMainWidget;
-  QComboBox *mIdentity, *mTransport;
+  QComboBox *mIdentity, *mTransport, *mFcc;
   KMLineEdit *mEdtFrom, *mEdtReplyTo, *mEdtTo, *mEdtCc, *mEdtBcc, *mEdtSubject;
-  QLabel    *mLblIdentity, *mLblTransport;
+  QLabel    *mLblIdentity, *mLblTransport, *mLblFcc;
   QLabel    *mLblFrom, *mLblReplyTo, *mLblTo, *mLblCc, *mLblBcc, *mLblSubject;
-  QCheckBox *mBtnIdentity, *mBtnTransport;
+  QCheckBox *mBtnIdentity, *mBtnTransport, *mBtnFcc;
   QPushButton *mBtnTo, *mBtnCc, *mBtnBcc, *mBtnFrom, *mBtnReplyTo;
   bool mSpellCheckInProgress;
   bool mDone;
@@ -520,7 +520,7 @@
   KToggleAction *signAction, *encryptAction, *confirmDeliveryAction;
   KToggleAction *confirmReadAction, *urgentAction, *allFieldsAction, *fromAction;
   KToggleAction *replyToAction, *toAction, *ccAction, *bccAction, *subjectAction;
-  KToggleAction *identityAction, *transportAction;
+  KToggleAction *identityAction, *transportAction, *fccAction;
   KToggleAction *toolbarAction, *statusbarAction;
   KToggleAction *wordWrapAction;
 
Index: kmfilteraction.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfilteraction.cpp,v
retrieving revision 1.65
diff -u -b -t -r1.65 kmfilteraction.cpp
--- kmfilteraction.cpp	2001/10/11 14:14:59	1.65
+++ kmfilteraction.cpp	2001/10/21 19:27:16
@@ -1013,6 +1013,15 @@
   if ( !mFolder )
     return ErrorButGoOn;
 
+  kdDebug(5006) << "KMFilterActionMove::process: msg->fcc() == " << msg->fcc() << \
endl; +
+  // If the user has defined a special folder to Fcc then we ignore folder filters.
+  if ( !msg->fcc().isEmpty() )
+  {
+      kdDebug(5006) << "KMFilterActionMove::process: will not process \
KMFilterActionWithFolder" << endl; +      return GoOn;
+  }
+
   KMFilterAction::tempOpenFolder( mFolder );
 
   if ( msg->parent() )
Index: kmfiltermgr.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfiltermgr.cpp,v
retrieving revision 1.31
diff -u -b -t -r1.31 kmfiltermgr.cpp
--- kmfiltermgr.cpp	2001/10/11 14:14:59	1.31
+++ kmfiltermgr.cpp	2001/10/21 19:27:16
@@ -2,7 +2,10 @@
 
 #include <kapplication.h>
 #include <kdebug.h>
+#include <kmessagebox.h>
+#include <klocale.h>
 
+#include "kmfoldermgr.h"
 #include "kmfiltermgr.h"
 #include "kmfilterdlg.h"
 #include "kmmessage.h"
@@ -90,6 +93,42 @@
   int status = -1;
   KMFilter::ReturnCode result;
 
+  // here we must treat X-KMail-Fcc on outgoing messages
+  if ( ( !msg->fcc().isEmpty() ) && ( aSet == Outbound ) )
+  {
+      kdDebug(5006) << "KMFilterMgr::process: we must " << msg->fcc() << \
"->moveMsg(msg) here" << endl; +      QStringList names;
+      QValueList<QGuardedPtr<KMFolder> > folders;
+      kernel->folderMgr()->createFolderList( &names, &folders );
+      KMFolder *f = 0;
+      for ( unsigned int i = 0; i < folders.count(); i++ )
+      {
+          KMFolder *tmp = *folders.at( i );
+          kdDebug(5006) << "KMFilterMgr::process: " << \
tmp->label().stripWhiteSpace() << endl; +          if ( \
tmp->label().stripWhiteSpace() == msg->fcc() ) +          {
+              kdDebug(5006) << "KMFilterMgr::process: found correct Fcc folder!" << \
endl; +              f = tmp;
+              break;
+          }
+      }
+
+      if ( f != 0 )
+      {
+          kdDebug(5006) << "KMFilterMgr::process: moving to " << f->label() << endl;
+          KMFilterAction::tempOpenFolder( f );
+          f->moveMsg( msg );
+          status = 0; // Message moved to a folder.
+      }
+      else
+      {
+          KMessageBox::information( NULL, i18n( "Could not save to '%1'. Will \
process filters normally." ) +                             .arg( msg->fcc() ) );
+          // we remove X-KMail-Fcc so that the filter will take over
+          msg->setFcc( QString::null );
+      }
+  }
+
   QPtrListIterator<KMFilter> it(*this);
   for (it.toFirst() ; !stopIt && it.current() ; ++it)
   {
Index: kmglobal.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmglobal.h,v
retrieving revision 1.22
diff -u -b -t -r1.22 kmglobal.h
--- kmglobal.h	2001/02/23 14:34:55	1.22
+++ kmglobal.h	2001/10/21 19:27:16
@@ -36,6 +36,7 @@
 #define HDR_FOLLOWUP_TO 0x80
 #define HDR_IDENTITY 0x100
 #define HDR_TRANSPORT 0x200
+#define HDR_FCC       0x400
 #define HDR_ALL      0x3ff
 
 #define HDR_STANDARD (HDR_SUBJECT|HDR_TO|HDR_CC)
Index: kmidentity.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmidentity.cpp,v
retrieving revision 1.36
diff -u -b -t -r1.36 kmidentity.cpp
--- kmidentity.cpp	2001/10/21 06:57:31	1.36
+++ kmidentity.cpp	2001/10/21 19:27:16
@@ -122,6 +122,7 @@
   mSignatureFile = config->readEntry("Signature File");
   mUseSignatureFile = config->readBoolEntry("UseSignatureFile", false);
   mSignatureInlineText = config->readEntry("Inline Signature");
+  mFcc = config->readEntry("Fcc");
   if (mIdentity == i18n( "Default" ))
     mTransport = QString::null;
   else
@@ -148,6 +149,7 @@
   config->writeEntry("UseSignatureFile", mUseSignatureFile );
   config->writeEntry("VCardFile", mVCardFile);
   config->writeEntry("Transport", mTransport);
+  config->writeEntry("Fcc", mFcc);
 
   if (aWithSync) config->sync();
 }
@@ -253,11 +255,19 @@
   mUseSignatureFile = flag;
 }
 
+
 //-----------------------------------------------------------------------------
 void KMIdentity::setTransport(const QString &str)
 {
   mTransport = str;
 }
+
+//-----------------------------------------------------------------------------
+void KMIdentity::setFcc(const QString &str)
+{
+  mFcc = str;
+}
+
 
 //-----------------------------------------------------------------------------
 QString KMIdentity::signature(void) const
Index: kmidentity.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmidentity.h,v
retrieving revision 1.12
diff -u -b -t -r1.12 kmidentity.h
--- kmidentity.h	2001/10/21 06:57:31	1.12
+++ kmidentity.h	2001/10/21 19:27:16
@@ -92,8 +92,15 @@
   QString transport(void) { return mTransport; }
   virtual void setTransport(const QString&);
 
+
+  /** The folder where sent messages from this identity will be
+      stored by default. */
+  QString fcc(void) { return mFcc; }
+  virtual void setFcc(const QString&);
+
 protected:
   QString mIdentity, mFullName, mOrganization, mPgpIdentity, mEmailAddr;
+  QString mFcc;
   QString mReplyToAddr, mSignatureFile;
   QString mSignatureInlineText, mTransport;
   QString mVCardFile;
Index: kmmessage.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmessage.cpp,v
retrieving revision 1.232
diff -u -b -t -r1.232 kmmessage.cpp
--- kmmessage.cpp	2001/10/21 06:57:31	1.232
+++ kmmessage.cpp	2001/10/21 19:27:16
@@ -154,6 +154,7 @@
   msg.removeHeaderField("X-Status");
   msg.removeHeaderField("X-KMail-Transport");
   msg.removeHeaderField("X-KMail-Identity");
+  msg.removeHeaderField("X-KMail-Fcc");
   msg.removeHeaderField("Bcc");
   return msg.asString();
 }
@@ -952,6 +953,7 @@
   bounceMsg.removeHeaderField( "X-KMail-Mark" );
   bounceMsg.removeHeaderField( "X-KMail-Identity" );
   bounceMsg.removeHeaderField( "X-KMail-Transport" );
+  bounceMsg.removeHeaderField( "X-KMail-Fcc" );
   //FIXME If you know other KMail-specific headers, please add them.
 
   KMMessage *msg = new KMMessage;
@@ -1117,6 +1119,11 @@
   else
     setHeaderField("X-KMail-Transport", ident.transport());
 
+  if (ident.fcc().isEmpty())
+    setFcc( QString::null );
+  else
+    setFcc( ident.fcc() );
+
   if (    !sCreateOwnMessageIdHeaders
        || sMessageIdSuffix.isEmpty()
        || sMessageIdSuffix.isNull() )
@@ -1354,6 +1361,30 @@
   setHeaderField("Bcc", aStr);
 }
 
+//-----------------------------------------------------------------------------
+QString KMMessage::fcc(void) const
+{
+    // we return whatever has something: variable or header. We
+    // do it because if the message was in the Outbox, it'd lost
+    // the contents of the variable but the header remains.
+    QString tmp = headerField( "X-KMail-Fcc" );
+    if ( tmp.isEmpty() )
+        return mFcc;
+    return tmp;
+}
+
+
+//-----------------------------------------------------------------------------
+void KMMessage::setFcc(const QString& aStr)
+{
+  kdDebug(5006) << "KMMessage::setFcc: setting mFcc to " << aStr << endl;
+  // we keep this information in the header _and_ in a member variable
+  // because eventually the message may be put in the outbox where the
+  // variable will be lost. OTOH, when we send the message to the
+  // filter, this header will disappear so we must have a variable.
+  mFcc = aStr.stripWhiteSpace();
+  setHeaderField( "X-KMail-Fcc", mFcc );
+}
 
 //-----------------------------------------------------------------------------
 QString KMMessage::who(void) const
Index: kmmessage.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmessage.h,v
retrieving revision 1.68
diff -u -b -t -r1.68 kmmessage.h
--- kmmessage.h	2001/10/14 15:31:26	1.68
+++ kmmessage.h	2001/10/21 19:27:16
@@ -167,6 +167,10 @@
   virtual QString bcc(void) const;
   virtual void setBcc(const QString& aStr);
 
+  /** Get or set the 'Fcc' header field */
+  virtual QString fcc(void) const;
+  virtual void setFcc(const QString& aStr);
+
   /** Get or set the 'From' header field */
   virtual QString from(void) const;
   virtual void setFrom(const QString& aStr);
@@ -366,6 +370,9 @@
 protected:
     /** Convert wildcards into normal string */
     QString formatString(const QString&) const;
+
+    /** Contains the name of the Fcc folder */
+    QString mFcc;
 
 protected:
     DwMessage* mMsg;


_______________________________________________
kmail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail


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

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