Update of /cvsroot/mahogany/M/src/gui
In directory usw-pr-cvs1:/tmp/cvs-serv7838/src/gui

Modified Files:
        wxComposeView.cpp 
Log Message:
added Recipient_Fcc support

Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.299
retrieving revision 1.300
diff -b -u -2 -r1.299 -r1.300
--- wxComposeView.cpp   3 Sep 2002 12:28:18 -0000       1.299
+++ wxComposeView.cpp   7 Sep 2002 00:04:45 -0000       1.300
@@ -118,6 +118,8 @@
 extern const MOption MP_HOSTNAME;
 extern const MOption MP_MSGVIEW_DEFAULT_ENCODING;
+extern const MOption MP_OUTGOINGFOLDER;
 extern const MOption MP_SENDMAILCMD;
 extern const MOption MP_SMTPHOST;
+extern const MOption MP_USEOUTGOINGFOLDER;
 extern const MOption MP_USERLEVEL;
 extern const MOption MP_USEVCARD;
@@ -277,5 +279,5 @@
    // starting from now, all methods are for the wxRcptXXX controls only
 
-   // change type of this one - called by choice
+   // change type of this one -- called by choice
    virtual void OnTypeChange(wxComposeView::RecipientType rcptType);
 
@@ -500,6 +502,4 @@
       {
          m_rcptControl = rcptControl;
-
-         SetToolTip(_("Expand the address using address books"));
       }
 
@@ -749,4 +749,7 @@
    m_choice->SetSelection(rt);
    m_text->SetValue(value);
+
+   // init the m_btnExpand state
+   OnTypeChange(rt);
 }
 
@@ -760,9 +763,42 @@
 void wxRcptControl::OnTypeChange(wxComposeView::RecipientType rcptType)
 {
-   // nothing to do here
+   switch ( rcptType )
+   {
+      case Composer::Recipient_To:
+      case Composer::Recipient_Cc:
+      case Composer::Recipient_Bcc:
+         m_btnExpand->Enable();
+         m_btnExpand->SetToolTip(_("Expand the address using address books"));
+         break;
+
+      case Composer::Recipient_Newsgroup:
+         // TODO-NEWS: we can't browse for newsgroups yet
+         m_btnExpand->Disable();
+         break;
+
+      case Composer::Recipient_Fcc:
+         // browse for folder now
+         m_btnExpand->Enable();
+         m_btnExpand->SetToolTip(_("Browse for folder"));
+         break;
+
+      case Composer::Recipient_None:
+         m_btnExpand->Disable();
+         break;
+
+      case Composer::Recipient_Max:
+      default:
+         FAIL_MSG( "unexpected rcpt type on wxRcptControl" );
+   }
 }
 
 void wxRcptControl::OnExpand()
 {
+   switch ( GetType() )
+   {
+      case Composer::Recipient_To:
+      case Composer::Recipient_Cc:
+      case Composer::Recipient_Bcc:
+         {
    Composer::RecipientType rcptType = m_text->DoExpand();
    if ( rcptType != Composer::Recipient_None &&
@@ -772,4 +808,42 @@
       SetType(rcptType);
    }
+         }
+         break;
+
+      case Composer::Recipient_Fcc:
+         // browse for folder
+         {
+            MFolder_obj folder(MDialog_FolderChoose
+                               (
+                                 m_composeView->GetFrame(),
+                                 NULL,
+                                 MDlg_Folder_NoFiles
+                               ));
+            if ( !folder )
+            {
+               // cancelled by user
+               break;
+            }
+
+            // separate the new folder with a comma from the previous ones
+            String fcc = m_text->GetValue();
+            fcc.Trim();
+            if ( !fcc.empty() && fcc[fcc.length() - 1] != ',' )
+            {
+               fcc += CANONIC_ADDRESS_SEPARATOR;
+            }
+
+            fcc += folder->GetFullName();
+
+            m_text->SetValue(fcc);
+         }
+         break;
+
+      case Composer::Recipient_Newsgroup:
+      case Composer::Recipient_None:
+      case Composer::Recipient_Max:
+      default:
+         FAIL_MSG( "unexpected wxRcptControl::OnExpand() call" );
+   }
 }
 
@@ -817,4 +891,7 @@
    GetChoice()->SetSelection(Composer::Recipient_To);
 
+   // init the m_btnExpand button here
+   wxRcptControl::OnTypeChange(GetType());
+
    return sizer;
 }
@@ -822,4 +899,6 @@
 void wxRcptMainControl::OnTypeChange(Composer::RecipientType rcptType)
 {
+   wxRcptControl::OnTypeChange(rcptType);
+
    GetComposer()->OnRcptTypeChange(rcptType);
 }
@@ -882,4 +961,5 @@
    _("Bcc"),
    _("Newsgroup"),
+   _("Fcc"),
    _("None"),
 };
@@ -949,7 +1029,15 @@
 Composer::RecipientType wxAddressTextCtrl::DoExpand()
 {
+   Composer::RecipientType rcptType;
+
+   switch ( m_rcptControl->GetType() )
+   {
+      case Composer::Recipient_To:
+      case Composer::Recipient_Cc:
+      case Composer::Recipient_Bcc:
+         {
    String text = GetValue();
 
-   Composer::RecipientType rcptType = GetComposer()->ExpandRecipient(&text);
+            rcptType = GetComposer()->ExpandRecipient(&text);
 
    if ( rcptType != Composer::Recipient_None )
@@ -958,4 +1046,27 @@
       SetInsertionPointEnd();
    }
+         }
+         break;
+
+      case Composer::Recipient_Newsgroup:
+         // TODO-NEWS: we should expand the newsgroups too
+         rcptType = Composer::Recipient_Newsgroup;
+         break;
+
+      case Composer::Recipient_Fcc:
+         // TODO: we could expand the folder names -- but for now we don't
+         rcptType = Composer::Recipient_Fcc;
+         break;
+
+      case Composer::Recipient_Max:
+      default:
+         FAIL_MSG( "unexpected wxRcptControl type" );
+         // fall through
+
+      case Composer::Recipient_None:
+         // nothing to do
+         rcptType = Composer::Recipient_None;
+         break;
+   }
 
    return rcptType;
@@ -1528,4 +1639,7 @@
    AddCc(READ_CONFIG(m_Profile, MP_COMPOSE_CC));
    AddBcc(READ_CONFIG(m_Profile, MP_COMPOSE_BCC));
+
+   if ( READ_CONFIG(m_Profile, MP_USEOUTGOINGFOLDER) )
+      AddFcc(READ_CONFIG_TEXT(m_Profile, MP_OUTGOINGFOLDER));
 }
 
@@ -1862,8 +1976,11 @@
    }
 
-   if ( addrType == Recipient_Newsgroup )
+   switch ( addrType )
+   {
+      case Recipient_Newsgroup:
    {
       // tokenize the string possibly containing several newsgroups
-      wxArrayString groups = wxStringTokenize(address, ",; \t", wxTOKEN_STRTOK);
+            const wxArrayString
+               groups = wxStringTokenize(address, ",; \t", wxTOKEN_STRTOK);
 
       size_t count = groups.GetCount();
@@ -1873,8 +1990,14 @@
       }
    }
-   else // email address
+         break;
+
+      case Recipient_To:
+      case Recipient_Cc:
+      case Recipient_Bcc:
+         // an email address
    {
       // split the string in addreses and add all of them
-      AddressList_obj addrList(address, READ_CONFIG(m_Profile, MP_HOSTNAME));
+            AddressList_obj addrList(address,
+                                     READ_CONFIG(m_Profile, MP_HOSTNAME));
       if ( addrList )
       {
@@ -1892,4 +2015,20 @@
       }
    }
+         break;
+
+      case Recipient_Fcc:
+         // folder names
+         AddRecipient(address, Recipient_Fcc);
+         break;
+
+      case Recipient_Max:
+      default:
+         FAIL_MSG( "unexpected wxRcptControl type" );
+         // fall through
+
+      case Recipient_None:
+         // nothing to do
+         ;
+   }
 }
 
@@ -3402,4 +3541,5 @@
    }
 
+   // from
    String from = GetFrom();
    if ( !from.empty() )
@@ -3408,6 +3548,9 @@
    }
 
-   // Add additional header lines: first for this time only and then also the
-   // headers stored in the profile
+   // fcc
+   msg->SetFcc(GetRecipients(Recipient_Fcc));
+
+   // add any additional header lines: first for this time only and then also
+   // the headers stored in the profile
    kbStringList::iterator i = m_ExtraHeaderLinesNames.begin();
    kbStringList::iterator i2 = m_ExtraHeaderLinesValues.begin();



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to