[Commits] (donn) Fixed "to" edit field for stamped mail items
commits at osafoundation.org
commits at osafoundation.org
Sun Oct 10 23:49:49 PDT 2004
Commit by: donn
Modified files:
chandler/parcels/osaf/contentmodel/mail/Mail.py 1.37 1.38
chandler/parcels/osaf/contentmodel/mail/parcel.xml 1.62 1.63
chandler/parcels/osaf/framework/blocks/detail/Detail.py 1.45 1.46
chandler/parcels/osaf/framework/blocks/detail/parcel.xml 1.34 1.35
Log message:
Fixed "to" edit field for stamped mail items
--------------------------------------------
* Fixes bug 2132, sending stamped mail
* Also tweaked display of 'me <>' to remove '<>'
- completes fix for 2139
* Changed the way 'to' and 'from' field labels were done
- no uses displayName attribute for the user-visible name
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/mail/Mail.py.diff?r1=text&tr1=1.37&r2=text&tr2=1.38
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/mail/parcel.xml.diff?r1=text&tr1=1.62&r2=text&tr2=1.63
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/Detail.py.diff?r1=text&tr1=1.45&r2=text&tr2=1.46
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/parcel.xml.diff?r1=text&tr1=1.34&r2=text&tr2=1.35
Index: chandler/parcels/osaf/contentmodel/mail/Mail.py
diff -u chandler/parcels/osaf/contentmodel/mail/Mail.py:1.37 chandler/parcels/osaf/contentmodel/mail/Mail.py:1.38
--- chandler/parcels/osaf/contentmodel/mail/Mail.py:1.37 Fri Oct 8 18:04:22 2004
+++ chandler/parcels/osaf/contentmodel/mail/Mail.py Sun Oct 10 23:49:47 2004
@@ -1,8 +1,8 @@
""" Classes used for Mail parcel kinds
"""
-__revision__ = "$Revision: 1.37 $"
-__date__ = "$Date: 2004/10/09 01:04:22 $"
+__revision__ = "$Revision: 1.38 $"
+__date__ = "$Date: 2004/10/11 06:49:47 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -566,7 +566,10 @@
except AttributeError:
fullName = ''
if fullName is not None and len (fullName) > 0:
- return fullName + ' <' + self.emailAddress + '>'
+ if self.emailAddress:
+ return fullName + ' <' + self.emailAddress + '>'
+ else:
+ return fullName
else:
return self.getItemDisplayName ()
Index: chandler/parcels/osaf/framework/blocks/detail/Detail.py
diff -u chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.45 chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.46
--- chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.45 Fri Oct 8 18:04:23 2004
+++ chandler/parcels/osaf/framework/blocks/detail/Detail.py Sun Oct 10 23:49:48 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.45 $"
-__date__ = "$Date: 2004/10/09 01:04:23 $"
+__version__ = "$Revision: 1.46 $"
+__date__ = "$Date: 2004/10/11 06:49:48 $"
__copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -158,17 +158,22 @@
# preflight the send/share request
# mail items and collections need their recievers set up
- try:
- whoTo = item.who
- except AttributeError:
- whoTo = []
- if len (whoTo) == 0:
- if isinstance (item, ItemCollection.ItemCollection):
+ message = None
+ if isinstance (item, ItemCollection.ItemCollection):
+ try:
+ whoTo = item.sharees
+ except AttributeError:
+ whoTo = []
+ if len (whoTo) == 0:
message = _('Please specify who to share this collection with in the "to" field.')
- elif isinstance (item, Mail.MailMessageMixin):
+ elif isinstance (item, Mail.MailMessageMixin):
+ try:
+ whoTo = item.toAddress
+ except AttributeError:
+ whoTo = []
+ if len (whoTo) == 0:
message = _('Please specify who to send this message to in the "to" field.')
- else:
- message = _('Please specify receivers.')
+ if message:
Util.ok(Globals.wxApplication.mainFrame,
_("No Receivers"), message)
else:
@@ -358,13 +363,6 @@
"""
Static Text that displays the name of the selected item's Attribute
"""
- # map internal attribute names into nicer display strings
- # DLDTBD - display mapping should come out of the repository
- displayMapping = {"displayName": "title",
- "fromAddress": "from",
- "toAddress": "to",
- }
-
def shouldShow (self, item):
contactKind = Contacts.ContactsParcel.getContactKind ()
if item is None or item.isItemOf (contactKind):
@@ -380,10 +378,8 @@
if redirectAttr is None:
redirectAttr = redirectName
# lookup better names for display of some attributes
- try:
- redirectAttr = self.displayMapping[redirectAttr]
- except KeyError:
- pass
+ if item.hasAttributeAspect (redirectAttr, 'displayName'):
+ redirectAttr = item.getAttributeAspect (redirectAttr, 'displayName')
if len (redirectAttr) > 0:
redirectAttr = redirectAttr + _(' ')
return redirectAttr
@@ -425,6 +421,19 @@
# then we should show ourself
return ItemCollectionOrMailMessageMixin (item)
+class ToMailBlock (DetailSynchronizer, LabeledTextAttributeBlock):
+ def shouldShow (self, item):
+ # if the item is a MailMessageMixin, or an ItemCollection,
+ # then we should show ourself
+ mailKind = Mail.MailParcel.getMailMessageMixinKind ()
+ return item.isItemOf (mailKind)
+
+class ToCollectionBlock (DetailSynchronizer, LabeledTextAttributeBlock):
+ def shouldShow (self, item):
+ # if the item is a MailMessageMixin, or an ItemCollection,
+ # then we should show ourself
+ return isinstance (item, ItemCollection.ItemCollection)
+
class StaticToFromText (StaticTextLabel):
def shouldShow (self, item):
# if the item is a MailMessageMixin, or an ItemCollection,
@@ -601,44 +610,76 @@
else:
widget.Clear()
-class ToEditField (EditTextAttribute):
+class EditToAddressTextAttribute (EditTextAttribute):
"""
- Body attribute of a ContentItem, e.g. a Note
+ An editable address attribute that resyncs the DV when changed
"""
def saveAttributeFromWidget(self, item, widget, validate):
if validate:
toFieldString = widget.GetValue()
- # remember the old value for nice change detection
- oldWhoString = item.ItemWhoString ()
-
# parse the addresses and get/create/validate
processedAddresses, validAddresses = self.parseEmailAddresses (item, toFieldString)
# reassign the list to the attribute
try:
- item.who = validAddresses
+ item.setAttributeValue (self.whichAttribute (), validAddresses)
except:
pass
- # Detect changes from none to some, and resynchronizeDetailView
- # so we can reenable the Notify button when sharees are added.
- if isinstance (item, ItemCollection.ItemCollection):
- whoString = item.ItemWhoString ()
- oneEmpty = len (whoString) == 0 or len (oldWhoString) == 0
- oneOK = len (whoString) > 0 or len (oldWhoString) > 0
- if oneEmpty and oneOK:
- self.resynchronizeDetailView ()
-
# redisplay the processed addresses in the widget
widget.SetValue (processedAddresses)
def loadAttributeIntoWidget (self, item, widget):
- whoString = item.ItemWhoString ()
- widget.SetValue (whoString)
+ if self.shouldShow (item):
+ try:
+ whoContacts = item.getAttributeValue (self.whichAttribute ())
+ except AttributeError:
+ whoContacts = ''
+ try:
+ numContacts = len(whoContacts)
+ except TypeError:
+ numContacts = -1
+ if numContacts == 0:
+ whoString = ''
+ elif numContacts > 0:
+ whoNames = []
+ for whom in whoContacts.values():
+ whoNames.append (str (whom))
+ whoString = ', '.join(whoNames)
+ else:
+ whoString = str (whoContacts)
+ if isinstance(whoContacts, Contacts.ContactName):
+ names = []
+ if len (whoContacts.firstName):
+ names.append (whoContacts.firstName)
+ if len (whoContacts.lastName):
+ names.append (whoContacts.lastName)
+ whoString = ' '.join(names)
+ widget.SetValue (whoString)
+class ToMailEditField (EditToAddressTextAttribute):
+ """
+ 'To' attribute of a Mail ContentItem, e.g. who it's sent to
+ """
def shouldShow (self, item):
- return ItemCollectionOrMailMessageMixin (item)
+ mailKind = Mail.MailParcel.getMailMessageMixinKind ()
+ return item.isItemOf (mailKind)
+
+ def whichAttribute(self):
+ # define the attribute to be used
+ return 'toAddress'
+
+class ToCollectionEditField (EditToAddressTextAttribute):
+ """
+ 'To' attribute of an ItemCollection, e.g. who it's shared with
+ """
+ def shouldShow (self, item):
+ return isinstance (item, ItemCollection.ItemCollection)
+
+ def whichAttribute(self):
+ # define the attribute to be used
+ return 'who'
class FromEditField (EditTextAttribute):
"""Edit field containing the sender's contact"""
Index: chandler/parcels/osaf/framework/blocks/detail/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.34 chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.35
--- chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.34 Mon Oct 4 16:52:29 2004
+++ chandler/parcels/osaf/framework/blocks/detail/parcel.xml Sun Oct 10 23:49:48 2004
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.34 $ -->
-<!-- $Date: 2004/10/04 23:52:29 $ -->
+<!-- $Revision: 1.35 $ -->
+<!-- $Date: 2004/10/11 06:49:48 $ -->
<!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -94,7 +94,8 @@
<!-- child blocks -->
<blockName value="DetailTrunk"/>
<childrenBlocks itemref="doc:MarkupBar"/>
- <childrenBlocks itemref="doc:ToArea"/>
+ <childrenBlocks itemref="doc:ToMailArea"/>
+ <childrenBlocks itemref="doc:ToCollectionArea"/>
<childrenBlocks itemref="doc:FromArea"/>
<childrenBlocks itemref="doc:ContactFullNameArea"/>
<childrenBlocks itemref="doc:HeadlineArea"/>
@@ -226,11 +227,11 @@
<minimumSize>300, 24</minimumSize>
</EditText>
- <ContentItemDetail itsName="ToArea"
- itemClass="osaf.framework.blocks.detail.Detail.ToAndFromBlock">
+ <ContentItemDetail itsName="ToMailArea"
+ itemClass="osaf.framework.blocks.detail.Detail.ToMailBlock">
<blockName value="ToArea"/>
<childrenBlocks itemref="doc:ToString"/>
- <childrenBlocks itemref="doc:ToEditField1"/>
+ <childrenBlocks itemref="doc:ToMailEditField"/>
<!-- Attributes -->
<orientationEnum>Horizontal</orientationEnum>
<selectedItemsAttribute>who</selectedItemsAttribute>
@@ -247,9 +248,41 @@
<minimumSize>100, 24</minimumSize>
</StaticText>
- <EditText itsName="ToEditField1"
- itemClass="osaf.framework.blocks.detail.Detail.ToEditField">
- <blockName value="ToEditField1"/>
+ <EditText itsName="ToMailEditField"
+ itemClass="osaf.framework.blocks.detail.Detail.ToMailEditField">
+ <blockName value="ToMailEditField"/>
+ <characterStyle itemref="doc:TextStyle"/>
+ <lineStyleEnum>SingleLine</lineStyleEnum>
+ <textStyleEnum>PlainText</textStyleEnum>
+ <readOnly>False</readOnly>
+ <textAlignmentEnum>Left</textAlignmentEnum>
+ <minimumSize>100, 24</minimumSize>
+ </EditText>
+
+ <ContentItemDetail itsName="ToCollectionArea"
+ itemClass="osaf.framework.blocks.detail.Detail.ToCollectionBlock">
+ <blockName value="ToArea"/>
+ <childrenBlocks itemref="doc:ToString2"/>
+ <childrenBlocks itemref="doc:ToCollectionEditField"/>
+ <!-- Attributes -->
+ <orientationEnum>Horizontal</orientationEnum>
+ <selectedItemsAttribute>who</selectedItemsAttribute>
+ <stretchFactor>0.0</stretchFactor>
+ </ContentItemDetail>
+
+ <StaticText itsName="ToString2"
+ itemClass="osaf.framework.blocks.detail.Detail.StaticToFromText">
+ <blockName value="ToString2"/>
+ <title>to</title>
+ <characterStyle itemref="doc:LabelStyle"/>
+ <textAlignmentEnum>Right</textAlignmentEnum>
+ <stretchFactor>0.0</stretchFactor>
+ <minimumSize>100, 24</minimumSize>
+ </StaticText>
+
+ <EditText itsName="ToCollectionEditField"
+ itemClass="osaf.framework.blocks.detail.Detail.ToCollectionEditField">
+ <blockName value="ToCollectionEditField"/>
<characterStyle itemref="doc:TextStyle"/>
<lineStyleEnum>SingleLine</lineStyleEnum>
<textStyleEnum>PlainText</textStyleEnum>
@@ -452,7 +485,7 @@
<buttonKind>Text</buttonKind>
<size>60,30</size>
- <minimumSize>60,30</minimumSize>
+ <minimumSize>75,30</minimumSize>
<border>2.0, 2.0, 2.0, 2.0</border>
<event itemref="doc:SendShareItem"/>
<alignmentEnum>alignMiddleRight</alignmentEnum>
Index: chandler/parcels/osaf/contentmodel/mail/parcel.xml
diff -u chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.62 chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.63
--- chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.62 Wed Oct 6 13:57:30 2004
+++ chandler/parcels/osaf/contentmodel/mail/parcel.xml Sun Oct 10 23:49:47 2004
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.62 $ -->
-<!-- $Date: 2004/10/06 20:57:30 $ -->
+<!-- $Revision: 1.63 $ -->
+<!-- $Date: 2004/10/11 06:49:47 $ -->
<!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -508,6 +508,7 @@
<Attribute itsName="toAddress">
+ <displayName value="to"/>
<type itemref="mail:EmailAddress" />
<cardinality value="list" />
<initialValue />
@@ -515,6 +516,7 @@
</Attribute>
<Attribute itsName="fromAddress">
+ <displayName value="from"/>
<type itemref="mail:EmailAddress" />
<initialValue itemref="None"/>
<inverseAttribute itemref="mail:EmailAddress/messagesFrom" />
More information about the Commits
mailing list