Commit by: stearns
Modified files:
chandler/parcels/osaf/framework/blocks/detail/Detail.py 1.106 1.107

Log message:
Fix 2698 (Fast typing in 'title' field can cause out-of-sequence characters), 
r=Morgen
- don't write back to the item on every keystroke.

Bugzilla links:
http://bugzilla.osafoundation.org/show_bug.cgi?id=2698

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/Detail.py.diff?r1=text&tr1=1.106&r2=text&tr2=1.107

Index: chandler/parcels/osaf/framework/blocks/detail/Detail.py
diff -u chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.106 
chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.107
--- chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.106       Fri Mar 
18 12:40:48 2005
+++ chandler/parcels/osaf/framework/blocks/detail/Detail.py     Mon Mar 21 
11:32:14 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.106 $"
-__date__ = "$Date: 2005/03/18 20:40:48 $"
+__version__ = "$Revision: 1.107 $"
+__date__ = "$Date: 2005/03/21 19:32:14 $"
 __copyright__ = "Copyright (c) 2004-2005 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm";
 
@@ -688,7 +688,7 @@
         
     def onKeyPressed (self, event):
         # called when we get an event; to saves away the data and skips the 
event
-        self.saveTextValue(validate = event.m_keyCode == wx.WXK_RETURN)
+        self.saveTextValue(validate = event.m_keyCode == wx.WXK_RETURN and 
self.lineStyleEnum != "MultiLine")
         event.Skip()
         
     def OnDataChanged (self):
@@ -718,15 +718,16 @@
         return knowsBody
         
     def saveAttributeFromWidget (self, item, widget, validate):
-        attributeName = GetRedirectAttribute(item, 'body');
-        textType = item.getAttributeAspect(attributeName, 'type')
-        widgetText = widget.GetValue()
-        if widgetText:
-            #XXX: Ensures that any non-ascii text entered in to the detail view
-            #     is properly encoded to ascii. This is a short term fix
-            #     and will not address issues related to internationalization
-            text = unicode(widgetText, 'utf-8', 'ignore').encode('ascii', 
'ignore')
-            item.body = textType.makeValue(text, encoding='ascii', 
indexed=True)
+        if validate:
+            attributeName = GetRedirectAttribute(item, 'body');
+            textType = item.getAttributeAspect(attributeName, 'type')
+            widgetText = widget.GetValue()
+            if widgetText:
+                #XXX: Ensures that any non-ascii text entered in to the detail 
view
+                #     is properly encoded to ascii. This is a short term fix
+                #     and will not address issues related to 
internationalization
+                text = unicode(widgetText, 'utf-8', 'ignore').encode('ascii', 
'ignore')
+                item.body = textType.makeValue(text, encoding='ascii', 
indexed=True)
         
     def loadAttributeIntoWidget (self, item, widget):  
         attributeName = GetRedirectAttribute(item, 'body');
@@ -890,7 +891,8 @@
     Our parent block knows which attribute we edit.
     """
     def saveAttributeFromWidget(self, item, widget, validate):
-        item.setAttributeValue(self.whichAttribute(), widget.GetValue())
+        if validate:
+            item.setAttributeValue(self.whichAttribute(), widget.GetValue())
 
     def loadAttributeIntoWidget(self, item, widget):
         try:

_______________________________________________
Commits mailing list
Commits@osafoundation.org
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to