Revision: 7203
http://svn.sourceforge.net/mahogany/?rev=7203&view=rev
Author: vadz
Date: 2007-01-07 16:09:32 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
moved ReceipientType enum from Composer class into its own header and global
scope
Modified Paths:
--------------
trunk/M/include/Composer.h
trunk/M/src/classes/ComposeTemplate.cpp
trunk/M/src/classes/MApplication.cpp
trunk/M/src/gui/wxComposeView.cpp
trunk/M/src/mail/MailFolder.cpp
Added Paths:
-----------
trunk/M/include/RecipientType.h
Modified: trunk/M/include/Composer.h
===================================================================
--- trunk/M/include/Composer.h 2007-01-07 14:20:39 UTC (rev 7202)
+++ trunk/M/include/Composer.h 2007-01-08 00:09:32 UTC (rev 7203)
@@ -15,6 +15,8 @@
#include "MailFolder.h" // for MailFolder::Params
+#include "RecipientType.h"
+
#include <wx/colour.h> // wxColour
class Profile;
@@ -54,18 +56,6 @@
class Composer
{
public:
- /// recipient address types
- enum RecipientType
- {
- Recipient_To,
- Recipient_Cc,
- Recipient_Bcc,
- Recipient_Newsgroup,
- Recipient_Fcc,
- Recipient_None,
- Recipient_Max
- };
-
/**
@name Different ways to create a new composer window
Added: trunk/M/include/RecipientType.h
===================================================================
--- trunk/M/include/RecipientType.h (rev 0)
+++ trunk/M/include/RecipientType.h 2007-01-08 00:09:32 UTC (rev 7203)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////////////////////
+// Project: M - cross platform e-mail GUI client
+// File name: RecipientType.h
+// Purpose: declaration of RecipientType enum
+// Author: Vadim Zeitlin
+// Created: 2007-01-08 (extracted from Composer.h)
+// CVS-ID: $Id$
+// Copyright: (c) 1998-2007 Mahogany team
+// Licence: M license
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ @file RecipientType.h
+ @brief Declaration of RecipientType enum.
+ */
+
+#ifndef MAHOGANY_RECIPIENTTYPE_H_
+#define MAHOGANY_RECIPIENTTYPE_H_
+
+/// Recipient address types
+enum RecipientType
+{
+ Recipient_To,
+ Recipient_Cc,
+ Recipient_Bcc,
+ Recipient_Newsgroup,
+ Recipient_Fcc,
+ Recipient_None,
+ Recipient_Max
+};
+
+#endif // MAHOGANY_RECIPIENTTYPE_H_
+
Modified: trunk/M/src/classes/ComposeTemplate.cpp
===================================================================
--- trunk/M/src/classes/ComposeTemplate.cpp 2007-01-07 14:20:39 UTC (rev
7202)
+++ trunk/M/src/classes/ComposeTemplate.cpp 2007-01-08 00:09:32 UTC (rev
7203)
@@ -200,7 +200,7 @@
// the variables in "message" category
//
- // NB: the values should be identical to wxComposeView::RecipientType enum
+ // NB: the values should be identical to RecipientType enum
// (or the code in ExpandMessage should be changed)
enum MessageHeader
{
@@ -1285,7 +1285,7 @@
case MessageHeader_LastName:
*value = ExtractFirstOrLastName
(
- m_cv.GetRecipients(Composer::Recipient_To),
+ m_cv.GetRecipients(Recipient_To),
header == MessageHeader_FirstName
);
break;
@@ -1296,7 +1296,7 @@
// the MessageHeader enum values are the same as RecipientType ones,
// so no translation is needed
- *value = m_cv.GetRecipients((Composer::RecipientType)header);
+ *value = m_cv.GetRecipients((RecipientType)header);
}
return TRUE;
Modified: trunk/M/src/classes/MApplication.cpp
===================================================================
--- trunk/M/src/classes/MApplication.cpp 2007-01-07 14:20:39 UTC (rev
7202)
+++ trunk/M/src/classes/MApplication.cpp 2007-01-08 00:09:32 UTC (rev
7203)
@@ -231,19 +231,17 @@
if ( composer )
{
- composer->AddRecipients(cmdLineOpts.composer.bcc,
- Composer::Recipient_Bcc);
- composer->AddRecipients(cmdLineOpts.composer.cc,
- Composer::Recipient_Cc);
+ composer->AddRecipients(cmdLineOpts.composer.bcc, Recipient_Bcc);
+ composer->AddRecipients(cmdLineOpts.composer.cc, Recipient_Cc);
composer->AddRecipients(cmdLineOpts.composer.newsgroups,
- Composer::Recipient_Newsgroup);
+ Recipient_Newsgroup);
// the "to" parameter may be a mailto: URL, pass it through our expansion
// function first
String to = cmdLineOpts.composer.to;
composer->ExpandRecipient(&to);
- composer->AddRecipients(to, Composer::Recipient_To);
+ composer->AddRecipients(to, Recipient_To);
composer->SetSubject(cmdLineOpts.composer.subject);
Modified: trunk/M/src/gui/wxComposeView.cpp
===================================================================
--- trunk/M/src/gui/wxComposeView.cpp 2007-01-07 14:20:39 UTC (rev 7202)
+++ trunk/M/src/gui/wxComposeView.cpp 2007-01-08 00:09:32 UTC (rev 7203)
@@ -310,16 +310,16 @@
virtual wxSizer *CreateControls(wxWindow *parent);
// initialize the controls
- void InitControls(const String& value, wxComposeView::RecipientType rt);
+ void InitControls(const String& value, RecipientType rt);
// get our text control
wxAddressTextCtrl *GetText() const { return m_text; }
// get the currently selected address type
- wxComposeView::RecipientType GetType() const;
+ RecipientType GetType() const;
// change the address type
- void SetType(wxComposeView::RecipientType rcptType);
+ void SetType(RecipientType rcptType);
// get the current value of the text field
wxString GetValue() const;
@@ -327,7 +327,7 @@
// starting from now, all methods are for the wxRcptXXX controls only
// change type of this one -- called by choice
- virtual void OnTypeChange(wxComposeView::RecipientType rcptType);
+ virtual void OnTypeChange(RecipientType rcptType);
// expand our text: called by the "Expand" button and
// wxAddressTextCtrl::OnChar()
@@ -371,7 +371,7 @@
virtual wxSizer *CreateControls(wxWindow *parent);
// notify the composer that the default recipient type changed
- virtual void OnTypeChange(wxComposeView::RecipientType rcptType);
+ virtual void OnTypeChange(RecipientType rcptType);
// callback for "add new recipient" button
void OnAdd();
@@ -447,7 +447,7 @@
// the back pointer to the entire group of controls
wxRcptControl *m_rcptControl;
- static const wxChar *ms_addrTypes[wxComposeView::Recipient_Max];
+ static const wxChar *ms_addrTypes[Recipient_Max];
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxRcptTypeChoice)
@@ -588,7 +588,7 @@
wxAddressTextCtrl(wxWindow *parent, wxRcptControl *rcptControl);
// expand the text in the control using the address book(s)
- Composer::RecipientType DoExpand();
+ RecipientType DoExpand();
// callbacks
void OnChar(wxKeyEvent& event);
@@ -1049,7 +1049,7 @@
}
void wxRcptControl::InitControls(const String& value,
- wxComposeView::RecipientType rt)
+ RecipientType rt)
{
CHECK_RET( m_choice, _T("must call CreateControls first") );
@@ -1067,25 +1067,25 @@
delete m_btnExpand;
}
-void wxRcptControl::OnTypeChange(wxComposeView::RecipientType rcptType)
+void wxRcptControl::OnTypeChange(RecipientType rcptType)
{
switch ( rcptType )
{
- case Composer::Recipient_To:
- case Composer::Recipient_Cc:
- case Composer::Recipient_Bcc:
+ case Recipient_To:
+ case Recipient_Cc:
+ case Recipient_Bcc:
m_btnExpand->Enable();
#if wxUSE_TOOLTIPS
m_btnExpand->SetToolTip(_("Expand the address using address books"));
#endif // wxUSE_TOOLTIPS
break;
- case Composer::Recipient_Newsgroup:
+ case Recipient_Newsgroup:
// TODO-NEWS: we can't browse for newsgroups yet
m_btnExpand->Disable();
break;
- case Composer::Recipient_Fcc:
+ case Recipient_Fcc:
// browse for folder now
m_btnExpand->Enable();
#if wxUSE_TOOLTIPS
@@ -1093,11 +1093,11 @@
#endif // wxUSE_TOOLTIPS
break;
- case Composer::Recipient_None:
+ case Recipient_None:
m_btnExpand->Disable();
break;
- case Composer::Recipient_Max:
+ case Recipient_Max:
default:
FAIL_MSG( _T("unexpected rcpt type on wxRcptControl") );
}
@@ -1107,13 +1107,13 @@
{
switch ( GetType() )
{
- case Composer::Recipient_To:
- case Composer::Recipient_Cc:
- case Composer::Recipient_Bcc:
+ case Recipient_To:
+ case Recipient_Cc:
+ case Recipient_Bcc:
{
- Composer::RecipientType rcptType = m_text->DoExpand();
- if ( rcptType != Composer::Recipient_None &&
- rcptType != Composer::Recipient_Max )
+ RecipientType rcptType = m_text->DoExpand();
+ if ( rcptType != Recipient_None &&
+ rcptType != Recipient_Max )
{
// update the type of the choice control
SetType(rcptType);
@@ -1121,7 +1121,7 @@
}
break;
- case Composer::Recipient_Fcc:
+ case Recipient_Fcc:
// browse for folder
{
MFolder_obj folder(MDialog_FolderChoose
@@ -1150,9 +1150,9 @@
}
break;
- case Composer::Recipient_Newsgroup:
- case Composer::Recipient_None:
- case Composer::Recipient_Max:
+ case Recipient_Newsgroup:
+ case Recipient_None:
+ case Recipient_Max:
default:
FAIL_MSG( _T("unexpected wxRcptControl::OnExpand() call") );
}
@@ -1160,15 +1160,15 @@
bool wxRcptControl::IsEnabled() const
{
- return m_choice->GetSelection() != Composer::Recipient_None;
+ return m_choice->GetSelection() != Recipient_None;
}
-Composer::RecipientType wxRcptControl::GetType() const
+RecipientType wxRcptControl::GetType() const
{
- return (Composer::RecipientType)m_choice->GetSelection();
+ return (RecipientType)m_choice->GetSelection();
}
-void wxRcptControl::SetType(Composer::RecipientType rcptType)
+void wxRcptControl::SetType(RecipientType rcptType)
{
m_choice->SetSelection(rcptType);
@@ -1198,8 +1198,8 @@
sizer->Add(m_btnAdd, 0, wxLEFT, LAYOUT_MARGIN);
// TODO-NEWS: set to Newsgroup for News
- GetChoice()->Delete(Composer::Recipient_None);
- GetChoice()->SetSelection(Composer::Recipient_To);
+ GetChoice()->Delete(Recipient_None);
+ GetChoice()->SetSelection(Recipient_To);
// init the m_btnExpand button here
wxRcptControl::OnTypeChange(GetType());
@@ -1207,7 +1207,7 @@
return sizer;
}
-void wxRcptMainControl::OnTypeChange(Composer::RecipientType rcptType)
+void wxRcptMainControl::OnTypeChange(RecipientType rcptType)
{
wxRcptControl::OnTypeChange(rcptType);
@@ -1217,8 +1217,8 @@
void wxRcptMainControl::OnAdd()
{
// expand before adding (make this optional?)
- Composer::RecipientType addrType = GetText()->DoExpand();
- if ( addrType == Composer::Recipient_None )
+ RecipientType addrType = GetText()->DoExpand();
+ if ( addrType == Recipient_None )
{
// cancelled or address is invalid
return;
@@ -1294,7 +1294,7 @@
void wxRcptTypeChoice::OnChoice(wxCommandEvent& event)
{
// notify the others (including the composer indirectly)
- m_rcptControl->OnTypeChange((Composer::RecipientType)event.GetSelection());
+ m_rcptControl->OnTypeChange((RecipientType)event.GetSelection());
event.Skip();
}
@@ -1367,21 +1367,21 @@
event.Skip();
}
-Composer::RecipientType wxAddressTextCtrl::DoExpand()
+RecipientType wxAddressTextCtrl::DoExpand()
{
- Composer::RecipientType rcptType;
+ RecipientType rcptType;
switch ( m_rcptControl->GetType() )
{
- case Composer::Recipient_To:
- case Composer::Recipient_Cc:
- case Composer::Recipient_Bcc:
+ case Recipient_To:
+ case Recipient_Cc:
+ case Recipient_Bcc:
{
String text = GetValue();
rcptType = GetComposer()->ExpandRecipient(&text);
- if ( rcptType != Composer::Recipient_None )
+ if ( rcptType != Recipient_None )
{
SetValue(text);
SetInsertionPointEnd();
@@ -1389,24 +1389,24 @@
}
break;
- case Composer::Recipient_Newsgroup:
+ case Recipient_Newsgroup:
// TODO-NEWS: we should expand the newsgroups too
- rcptType = Composer::Recipient_Newsgroup;
+ rcptType = Recipient_Newsgroup;
break;
- case Composer::Recipient_Fcc:
+ case Recipient_Fcc:
// TODO: we could expand the folder names -- but for now we don't
- rcptType = Composer::Recipient_Fcc;
+ rcptType = Recipient_Fcc;
break;
- case Composer::Recipient_Max:
+ case Recipient_Max:
default:
FAIL_MSG( _T("unexpected wxRcptControl type") );
// fall through
- case Composer::Recipient_None:
+ case Recipient_None:
// nothing to do
- rcptType = Composer::Recipient_None;
+ rcptType = Recipient_None;
break;
}
@@ -2301,7 +2301,7 @@
// wxComposeView address headers stuff
// ----------------------------------------------------------------------------
-Composer::RecipientType
+RecipientType
wxComposeView::ExpandRecipient(String *textAddress)
{
// don't do anything for the newsgroups
@@ -2309,7 +2309,7 @@
// TODO-NEWS: expand using .newsrc?
if ( m_mode == wxComposeView::Mode_News )
{
- return Composer::Recipient_Newsgroup;
+ return Recipient_Newsgroup;
}
// try to expand the last component
@@ -2332,7 +2332,7 @@
wxLogStatus(GetFrame(),
_("Nothing to expand - please enter something."));
- return Composer::Recipient_None;
+ return Recipient_None;
}
// find the starting position of the last address in the address list
@@ -2386,26 +2386,26 @@
String textOrig = text.c_str() + nLastAddr;
// do we have an explicit address type specifier
- Composer::RecipientType addrType = Composer::Recipient_Max;
+ RecipientType addrType = Recipient_Max;
if ( textOrig.length() > 3 )
{
// check for to:, cc: or bcc: prefix
if ( textOrig[2u] == ':' )
{
if ( toupper(textOrig[0u]) == 'T' && toupper(textOrig[1u]) == 'O' )
- addrType = Composer::Recipient_To;
+ addrType = Recipient_To;
else if ( toupper(textOrig[0u]) == 'C' && toupper(textOrig[1u]) ==
'C' )
- addrType = Composer::Recipient_Cc;
+ addrType = Recipient_Cc;
}
else if ( textOrig[3u] == ':' && textOrig(0, 3).Upper() == _T("BCC") )
{
- addrType = Composer::Recipient_Bcc;
+ addrType = Recipient_Bcc;
}
- if ( addrType != Composer::Recipient_Max )
+ if ( addrType != Recipient_Max )
{
// erase the colon as well
- textOrig.erase(0, addrType == Composer::Recipient_Bcc ? 4 : 3);
+ textOrig.erase(0, addrType == Recipient_Bcc ? 4 : 3);
}
}
@@ -2445,7 +2445,7 @@
this) )
{
// cancelled, don't do anything
- return Composer::Recipient_None;
+ return Recipient_None;
}
// construct the replacement string(s)
@@ -2763,7 +2763,7 @@
// helper of GetRecipients(): add the address from this control if it is of
// correct type, to the address array
static void
-GetRecipientFromControl(wxComposeView::RecipientType type,
+GetRecipientFromControl(RecipientType type,
wxRcptControl *rcpt,
wxArrayString& list)
{
Modified: trunk/M/src/mail/MailFolder.cpp
===================================================================
--- trunk/M/src/mail/MailFolder.cpp 2007-01-07 14:20:39 UTC (rev 7202)
+++ trunk/M/src/mail/MailFolder.cpp 2007-01-08 00:09:32 UTC (rev 7203)
@@ -639,20 +639,20 @@
for ( n = 0; n < count; n++ )
{
rcptAddresses.Add(addresses[n]);
- rcptTypes.Add(Composer::Recipient_To);
+ rcptTypes.Add(Recipient_To);
}
}
else // not from myself
{
rcptAddresses.Add(rcptMain);
- rcptTypes.Add(Composer::Recipient_To);
+ rcptTypes.Add(Recipient_To);
// add the remaining Reply-To addresses (usually there will be none)
for ( n = 1; n < countReplyTo; n++ )
{
// FIXME: same as above
rcptAddresses.Add(MailFolder::DecodeHeader(replyToAddresses[n]));
- rcptTypes.Add(Composer::Recipient_To);
+ rcptTypes.Add(Recipient_To);
}
}
}
@@ -680,7 +680,7 @@
while ( n-- )
{
- cv->AddRecipients(rcptAddresses[n],
(Composer::RecipientType)rcptTypes[n], (n > 0 ? false : true));
+ cv->AddRecipients(rcptAddresses[n], (RecipientType)rcptTypes[n], (n >
0 ? false : true));
}
return;
@@ -789,7 +789,7 @@
for ( size_t n = 0; n < countLists; n++ )
{
rcptAddresses.Add(uniqueAddresses[addressesList[n]]);
- rcptTypes.Add(Composer::Recipient_To);
+ rcptTypes.Add(Recipient_To);
}
}
else // no mailing list addresses found
@@ -824,7 +824,7 @@
String address = uniqueAddresses[n];
// what we do with this address depends on the kind of reply
- Composer::RecipientType rcptType;
+ RecipientType rcptType;
switch ( replyKind )
{
default:
@@ -834,7 +834,7 @@
case MailFolder::REPLY_SENDER:
// still add addresses to allow easily adding them to the
// recipient list - just disable them by default
- rcptType = Composer::Recipient_None;
+ rcptType = Recipient_None;
break;
case MailFolder::REPLY_ALL:
@@ -842,10 +842,10 @@
//
// but if the dog was only cc'ed, we should keep cc'ing it
rcptType = Address::IsInList(replyToAddresses, address)
- ? Composer::Recipient_To
+ ? Recipient_To
: Address::IsInList(ccAddresses, address)
- ? Composer::Recipient_Cc
- : Composer::Recipient_To;
+ ? Recipient_Cc
+ : Recipient_To;
break;
case MailFolder::REPLY_LIST:
@@ -854,7 +854,7 @@
continue;
// do keep the others but disabled by default
- rcptType = Composer::Recipient_None;
+ rcptType = Recipient_None;
break;
}
@@ -869,7 +869,7 @@
while ( n-- )
{
- cv->AddRecipients(rcptAddresses[n],
(Composer::RecipientType)rcptTypes[n], (n > 0 ? false : true));
+ cv->AddRecipients(rcptAddresses[n], (RecipientType)rcptTypes[n], !n);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates